ChimeraTK-ControlSystemAdapter-OPCUAAdapter  01.08.00
open62541.c
Go to the documentation of this file.
1 /* THIS IS A SINGLE-FILE DISTRIBUTION CONCATENATED FROM THE OPEN62541 SOURCES
2  * visit http://open62541.org/ for information about this software
3  * Git-Revision: v0.2.2
4  */
5 
6 /*
7  * Copyright (C) 2014-2016 the contributors as stated in the AUTHORS file
8  *
9  * This file is part of open62541. open62541 is free software: you can
10  * redistribute it and/or modify it under the terms of the Mozilla Public
11  * License v2.0 as stated in the LICENSE file provided with open62541.
12  *
13  * open62541 is distributed in the hope that it will be useful, but WITHOUT ANY
14  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  * A PARTICULAR PURPOSE.
16  */
17 
18 #ifndef UA_DYNAMIC_LINKING_EXPORT
19 # define UA_DYNAMIC_LINKING_EXPORT
20 #endif
21 
22 #include "open62541.h"
23 
24 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/queue.h" ***********************************/
25 
26 /* $OpenBSD: queue.h,v 1.38 2013/07/03 15:05:21 fgsch Exp $ */
27 /* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */
28 
29 /*
30  * Copyright (c) 1991, 1993
31  * The Regents of the University of California. All rights reserved.
32  *
33  * Redistribution and use in source and binary forms, with or without
34  * modification, are permitted provided that the following conditions
35  * are met:
36  * 1. Redistributions of source code must retain the above copyright
37  * notice, this list of conditions and the following disclaimer.
38  * 2. Redistributions in binary form must reproduce the above copyright
39  * notice, this list of conditions and the following disclaimer in the
40  * documentation and/or other materials provided with the distribution.
41  * 3. Neither the name of the University nor the names of its contributors
42  * may be used to endorse or promote products derived from this software
43  * without specific prior written permission.
44  *
45  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
46  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48  * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
49  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55  * SUCH DAMAGE.
56  *
57  * @(#)queue.h 8.5 (Berkeley) 8/20/94
58  */
59 
60 #ifndef _SYS_QUEUE_H_
61 #define _SYS_QUEUE_H_
62 
63 /*
64  * This file defines five types of data structures: singly-linked lists,
65  * lists, simple queues, tail queues, and circular queues.
66  *
67  *
68  * A singly-linked list is headed by a single forward pointer. The elements
69  * are singly linked for minimum space and pointer manipulation overhead at
70  * the expense of O(n) removal for arbitrary elements. New elements can be
71  * added to the list after an existing element or at the head of the list.
72  * Elements being removed from the head of the list should use the explicit
73  * macro for this purpose for optimum efficiency. A singly-linked list may
74  * only be traversed in the forward direction. Singly-linked lists are ideal
75  * for applications with large datasets and few or no removals or for
76  * implementing a LIFO queue.
77  *
78  * A list is headed by a single forward pointer (or an array of forward
79  * pointers for a hash table header). The elements are doubly linked
80  * so that an arbitrary element can be removed without a need to
81  * traverse the list. New elements can be added to the list before
82  * or after an existing element or at the head of the list. A list
83  * may only be traversed in the forward direction.
84  *
85  * A simple queue is headed by a pair of pointers, one the head of the
86  * list and the other to the tail of the list. The elements are singly
87  * linked to save space, so elements can only be removed from the
88  * head of the list. New elements can be added to the list before or after
89  * an existing element, at the head of the list, or at the end of the
90  * list. A simple queue may only be traversed in the forward direction.
91  *
92  * A tail queue is headed by a pair of pointers, one to the head of the
93  * list and the other to the tail of the list. The elements are doubly
94  * linked so that an arbitrary element can be removed without a need to
95  * traverse the list. New elements can be added to the list before or
96  * after an existing element, at the head of the list, or at the end of
97  * the list. A tail queue may be traversed in either direction.
98  *
99  * A circle queue is headed by a pair of pointers, one to the head of the
100  * list and the other to the tail of the list. The elements are doubly
101  * linked so that an arbitrary element can be removed without a need to
102  * traverse the list. New elements can be added to the list before or after
103  * an existing element, at the head of the list, or at the end of the list.
104  * A circle queue may be traversed in either direction, but has a more
105  * complex end of list detection.
106  *
107  * For details on the use of these macros, see the queue(3) manual page.
108  */
109 
110 #if defined(QUEUE_MACRO_DEBUG) || (defined(_KERNEL) && defined(DIAGNOSTIC))
111 #define _Q_INVALIDATE(a) (a) = ((void *)-1)
112 #else
113 #define _Q_INVALIDATE(a)
114 #endif
115 
116 /*
117  * Singly-linked List definitions.
118  */
119 #define SLIST_HEAD(name, type) \
120 struct name { \
121  struct type *slh_first; /* first element */ \
122 }
123 
124 #define SLIST_HEAD_INITIALIZER(head) \
125  { NULL }
126 
127 /* Fix redefinition of SLIST_ENTRY on mingw winnt.h */
128 # ifdef SLIST_ENTRY
129 # undef SLIST_ENTRY
130 # endif
131 
132 #define SLIST_ENTRY(type) \
133 struct { \
134  struct type *sle_next; /* next element */ \
135 }
136 
137 /*
138  * Singly-linked List access methods.
139  */
140 #define SLIST_FIRST(head) ((head)->slh_first)
141 #define SLIST_END(head) NULL
142 #define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head))
143 #define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
144 
145 #define SLIST_FOREACH(var, head, field) \
146  for((var) = SLIST_FIRST(head); \
147  (var) != SLIST_END(head); \
148  (var) = SLIST_NEXT(var, field))
149 
150 #define SLIST_FOREACH_SAFE(var, head, field, tvar) \
151  for ((var) = SLIST_FIRST(head); \
152  (var) && ((tvar) = SLIST_NEXT(var, field), 1); \
153  (var) = (tvar))
154 
155 /*
156  * Singly-linked List functions.
157  */
158 #define SLIST_INIT(head) { \
159  SLIST_FIRST(head) = SLIST_END(head); \
160 }
161 
162 #define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
163  (elm)->field.sle_next = (slistelm)->field.sle_next; \
164  (slistelm)->field.sle_next = (elm); \
165 } while (0)
166 
167 #define SLIST_INSERT_HEAD(head, elm, field) do { \
168  (elm)->field.sle_next = (head)->slh_first; \
169  (head)->slh_first = (elm); \
170 } while (0)
171 
172 #define SLIST_REMOVE_AFTER(elm, field) do { \
173  (elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \
174 } while (0)
175 
176 #define SLIST_REMOVE_HEAD(head, field) do { \
177  (head)->slh_first = (head)->slh_first->field.sle_next; \
178 } while (0)
179 
180 #define SLIST_REMOVE(head, elm, type, field) do { \
181  if ((head)->slh_first == (elm)) { \
182  SLIST_REMOVE_HEAD((head), field); \
183  } else { \
184  struct type *curelm = (head)->slh_first; \
185  \
186  while (curelm->field.sle_next != (elm)) \
187  curelm = curelm->field.sle_next; \
188  curelm->field.sle_next = \
189  curelm->field.sle_next->field.sle_next; \
190  _Q_INVALIDATE((elm)->field.sle_next); \
191  } \
192 } while (0)
193 
194 /*
195  * List definitions.
196  */
197 #define LIST_HEAD(name, type) \
198 struct name { \
199  struct type *lh_first; /* first element */ \
200 }
201 
202 #define LIST_HEAD_INITIALIZER(head) \
203  { NULL }
204 
205 #define LIST_ENTRY(type) \
206 struct { \
207  struct type *le_next; /* next element */ \
208  struct type **le_prev; /* address of previous next element */ \
209 }
210 
211 /*
212  * List access methods
213  */
214 #define LIST_FIRST(head) ((head)->lh_first)
215 #define LIST_END(head) NULL
216 #define LIST_EMPTY(head) (LIST_FIRST(head) == LIST_END(head))
217 #define LIST_NEXT(elm, field) ((elm)->field.le_next)
218 
219 #define LIST_FOREACH(var, head, field) \
220  for((var) = LIST_FIRST(head); \
221  (var)!= LIST_END(head); \
222  (var) = LIST_NEXT(var, field))
223 
224 #define LIST_FOREACH_SAFE(var, head, field, tvar) \
225  for ((var) = LIST_FIRST(head); \
226  (var) && ((tvar) = LIST_NEXT(var, field), 1); \
227  (var) = (tvar))
228 
229 /*
230  * List functions.
231  */
232 #define LIST_INIT(head) do { \
233  LIST_FIRST(head) = LIST_END(head); \
234 } while (0)
235 
236 #define LIST_INSERT_AFTER(listelm, elm, field) do { \
237  if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
238  (listelm)->field.le_next->field.le_prev = \
239  &(elm)->field.le_next; \
240  (listelm)->field.le_next = (elm); \
241  (elm)->field.le_prev = &(listelm)->field.le_next; \
242 } while (0)
243 
244 #define LIST_INSERT_BEFORE(listelm, elm, field) do { \
245  (elm)->field.le_prev = (listelm)->field.le_prev; \
246  (elm)->field.le_next = (listelm); \
247  *(listelm)->field.le_prev = (elm); \
248  (listelm)->field.le_prev = &(elm)->field.le_next; \
249 } while (0)
250 
251 #define LIST_INSERT_HEAD(head, elm, field) do { \
252  if (((elm)->field.le_next = (head)->lh_first) != NULL) \
253  (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
254  (head)->lh_first = (elm); \
255  (elm)->field.le_prev = &(head)->lh_first; \
256 } while (0)
257 
258 #define LIST_REMOVE(elm, field) do { \
259  if ((elm)->field.le_next != NULL) \
260  (elm)->field.le_next->field.le_prev = \
261  (elm)->field.le_prev; \
262  *(elm)->field.le_prev = (elm)->field.le_next; \
263  _Q_INVALIDATE((elm)->field.le_prev); \
264  _Q_INVALIDATE((elm)->field.le_next); \
265 } while (0)
266 
267 #define LIST_REPLACE(elm, elm2, field) do { \
268  if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \
269  (elm2)->field.le_next->field.le_prev = \
270  &(elm2)->field.le_next; \
271  (elm2)->field.le_prev = (elm)->field.le_prev; \
272  *(elm2)->field.le_prev = (elm2); \
273  _Q_INVALIDATE((elm)->field.le_prev); \
274  _Q_INVALIDATE((elm)->field.le_next); \
275 } while (0)
276 
277 /*
278  * Simple queue definitions.
279  */
280 #define SIMPLEQ_HEAD(name, type) \
281 struct name { \
282  struct type *sqh_first; /* first element */ \
283  struct type **sqh_last; /* addr of last next element */ \
284 }
285 
286 #define SIMPLEQ_HEAD_INITIALIZER(head) \
287  { NULL, &(head).sqh_first }
288 
289 #define SIMPLEQ_ENTRY(type) \
290 struct { \
291  struct type *sqe_next; /* next element */ \
292 }
293 
294 /*
295  * Simple queue access methods.
296  */
297 #define SIMPLEQ_FIRST(head) ((head)->sqh_first)
298 #define SIMPLEQ_END(head) NULL
299 #define SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head))
300 #define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
301 
302 #define SIMPLEQ_FOREACH(var, head, field) \
303  for((var) = SIMPLEQ_FIRST(head); \
304  (var) != SIMPLEQ_END(head); \
305  (var) = SIMPLEQ_NEXT(var, field))
306 
307 #define SIMPLEQ_FOREACH_SAFE(var, head, field, tvar) \
308  for ((var) = SIMPLEQ_FIRST(head); \
309  (var) && ((tvar) = SIMPLEQ_NEXT(var, field), 1); \
310  (var) = (tvar))
311 
312 /*
313  * Simple queue functions.
314  */
315 #define SIMPLEQ_INIT(head) do { \
316  (head)->sqh_first = NULL; \
317  (head)->sqh_last = &(head)->sqh_first; \
318 } while (0)
319 
320 #define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
321  if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
322  (head)->sqh_last = &(elm)->field.sqe_next; \
323  (head)->sqh_first = (elm); \
324 } while (0)
325 
326 #define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
327  (elm)->field.sqe_next = NULL; \
328  *(head)->sqh_last = (elm); \
329  (head)->sqh_last = &(elm)->field.sqe_next; \
330 } while (0)
331 
332 #define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
333  if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
334  (head)->sqh_last = &(elm)->field.sqe_next; \
335  (listelm)->field.sqe_next = (elm); \
336 } while (0)
337 
338 #define SIMPLEQ_REMOVE_HEAD(head, field) do { \
339  if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
340  (head)->sqh_last = &(head)->sqh_first; \
341 } while (0)
342 
343 #define SIMPLEQ_REMOVE_AFTER(head, elm, field) do { \
344  if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \
345  == NULL) \
346  (head)->sqh_last = &(elm)->field.sqe_next; \
347 } while (0)
348 
349 /*
350  * XOR Simple queue definitions.
351  */
352 #define XSIMPLEQ_HEAD(name, type) \
353 struct name { \
354  struct type *sqx_first; /* first element */ \
355  struct type **sqx_last; /* addr of last next element */ \
356  unsigned long sqx_cookie; \
357 }
358 
359 #define XSIMPLEQ_ENTRY(type) \
360 struct { \
361  struct type *sqx_next; /* next element */ \
362 }
363 
364 /*
365  * XOR Simple queue access methods.
366  */
367 #define XSIMPLEQ_XOR(head, ptr) ((__typeof(ptr))((head)->sqx_cookie ^ \
368  (unsigned long)(ptr)))
369 #define XSIMPLEQ_FIRST(head) XSIMPLEQ_XOR(head, ((head)->sqx_first))
370 #define XSIMPLEQ_END(head) NULL
371 #define XSIMPLEQ_EMPTY(head) (XSIMPLEQ_FIRST(head) == XSIMPLEQ_END(head))
372 #define XSIMPLEQ_NEXT(head, elm, field) XSIMPLEQ_XOR(head, ((elm)->field.sqx_next))
373 
374 
375 #define XSIMPLEQ_FOREACH(var, head, field) \
376  for ((var) = XSIMPLEQ_FIRST(head); \
377  (var) != XSIMPLEQ_END(head); \
378  (var) = XSIMPLEQ_NEXT(head, var, field))
379 
380 #define XSIMPLEQ_FOREACH_SAFE(var, head, field, tvar) \
381  for ((var) = XSIMPLEQ_FIRST(head); \
382  (var) && ((tvar) = XSIMPLEQ_NEXT(head, var, field), 1); \
383  (var) = (tvar))
384 
385 /*
386  * XOR Simple queue functions.
387  */
388 #define XSIMPLEQ_INIT(head) do { \
389  arc4random_buf(&(head)->sqx_cookie, sizeof((head)->sqx_cookie)); \
390  (head)->sqx_first = XSIMPLEQ_XOR(head, NULL); \
391  (head)->sqx_last = XSIMPLEQ_XOR(head, &(head)->sqx_first); \
392 } while (0)
393 
394 #define XSIMPLEQ_INSERT_HEAD(head, elm, field) do { \
395  if (((elm)->field.sqx_next = (head)->sqx_first) == \
396  XSIMPLEQ_XOR(head, NULL)) \
397  (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
398  (head)->sqx_first = XSIMPLEQ_XOR(head, (elm)); \
399 } while (0)
400 
401 #define XSIMPLEQ_INSERT_TAIL(head, elm, field) do { \
402  (elm)->field.sqx_next = XSIMPLEQ_XOR(head, NULL); \
403  *(XSIMPLEQ_XOR(head, (head)->sqx_last)) = XSIMPLEQ_XOR(head, (elm)); \
404  (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
405 } while (0)
406 
407 #define XSIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
408  if (((elm)->field.sqx_next = (listelm)->field.sqx_next) == \
409  XSIMPLEQ_XOR(head, NULL)) \
410  (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
411  (listelm)->field.sqx_next = XSIMPLEQ_XOR(head, (elm)); \
412 } while (0)
413 
414 #define XSIMPLEQ_REMOVE_HEAD(head, field) do { \
415  if (((head)->sqx_first = XSIMPLEQ_XOR(head, \
416  (head)->sqx_first)->field.sqx_next) == XSIMPLEQ_XOR(head, NULL)) \
417  (head)->sqx_last = XSIMPLEQ_XOR(head, &(head)->sqx_first); \
418 } while (0)
419 
420 #define XSIMPLEQ_REMOVE_AFTER(head, elm, field) do { \
421  if (((elm)->field.sqx_next = XSIMPLEQ_XOR(head, \
422  (elm)->field.sqx_next)->field.sqx_next) \
423  == XSIMPLEQ_XOR(head, NULL)) \
424  (head)->sqx_last = \
425  XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
426 } while (0)
427 
428 
429 /*
430  * Tail queue definitions.
431  */
432 #define TAILQ_HEAD(name, type) \
433 struct name { \
434  struct type *tqh_first; /* first element */ \
435  struct type **tqh_last; /* addr of last next element */ \
436 }
437 
438 #define TAILQ_HEAD_INITIALIZER(head) \
439  { NULL, &(head).tqh_first }
440 
441 #define TAILQ_ENTRY(type) \
442 struct { \
443  struct type *tqe_next; /* next element */ \
444  struct type **tqe_prev; /* address of previous next element */ \
445 }
446 
447 /*
448  * tail queue access methods
449  */
450 #define TAILQ_FIRST(head) ((head)->tqh_first)
451 #define TAILQ_END(head) NULL
452 #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
453 #define TAILQ_LAST(head, headname) \
454  (*(((struct headname *)((head)->tqh_last))->tqh_last))
455 /* XXX */
456 #define TAILQ_PREV(elm, headname, field) \
457  (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
458 #define TAILQ_EMPTY(head) \
459  (TAILQ_FIRST(head) == TAILQ_END(head))
460 
461 #define TAILQ_FOREACH(var, head, field) \
462  for((var) = TAILQ_FIRST(head); \
463  (var) != TAILQ_END(head); \
464  (var) = TAILQ_NEXT(var, field))
465 
466 #define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
467  for ((var) = TAILQ_FIRST(head); \
468  (var) != TAILQ_END(head) && \
469  ((tvar) = TAILQ_NEXT(var, field), 1); \
470  (var) = (tvar))
471 
472 
473 #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
474  for((var) = TAILQ_LAST(head, headname); \
475  (var) != TAILQ_END(head); \
476  (var) = TAILQ_PREV(var, headname, field))
477 
478 #define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
479  for ((var) = TAILQ_LAST(head, headname); \
480  (var) != TAILQ_END(head) && \
481  ((tvar) = TAILQ_PREV(var, headname, field), 1); \
482  (var) = (tvar))
483 
484 /*
485  * Tail queue functions.
486  */
487 #define TAILQ_INIT(head) do { \
488  (head)->tqh_first = NULL; \
489  (head)->tqh_last = &(head)->tqh_first; \
490 } while (0)
491 
492 #define TAILQ_INSERT_HEAD(head, elm, field) do { \
493  if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
494  (head)->tqh_first->field.tqe_prev = \
495  &(elm)->field.tqe_next; \
496  else \
497  (head)->tqh_last = &(elm)->field.tqe_next; \
498  (head)->tqh_first = (elm); \
499  (elm)->field.tqe_prev = &(head)->tqh_first; \
500 } while (0)
501 
502 #define TAILQ_INSERT_TAIL(head, elm, field) do { \
503  (elm)->field.tqe_next = NULL; \
504  (elm)->field.tqe_prev = (head)->tqh_last; \
505  *(head)->tqh_last = (elm); \
506  (head)->tqh_last = &(elm)->field.tqe_next; \
507 } while (0)
508 
509 #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
510  if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
511  (elm)->field.tqe_next->field.tqe_prev = \
512  &(elm)->field.tqe_next; \
513  else \
514  (head)->tqh_last = &(elm)->field.tqe_next; \
515  (listelm)->field.tqe_next = (elm); \
516  (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
517 } while (0)
518 
519 #define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
520  (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
521  (elm)->field.tqe_next = (listelm); \
522  *(listelm)->field.tqe_prev = (elm); \
523  (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
524 } while (0)
525 
526 #define TAILQ_REMOVE(head, elm, field) do { \
527  if (((elm)->field.tqe_next) != NULL) \
528  (elm)->field.tqe_next->field.tqe_prev = \
529  (elm)->field.tqe_prev; \
530  else \
531  (head)->tqh_last = (elm)->field.tqe_prev; \
532  *(elm)->field.tqe_prev = (elm)->field.tqe_next; \
533  _Q_INVALIDATE((elm)->field.tqe_prev); \
534  _Q_INVALIDATE((elm)->field.tqe_next); \
535 } while (0)
536 
537 #define TAILQ_REPLACE(head, elm, elm2, field) do { \
538  if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \
539  (elm2)->field.tqe_next->field.tqe_prev = \
540  &(elm2)->field.tqe_next; \
541  else \
542  (head)->tqh_last = &(elm2)->field.tqe_next; \
543  (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \
544  *(elm2)->field.tqe_prev = (elm2); \
545  _Q_INVALIDATE((elm)->field.tqe_prev); \
546  _Q_INVALIDATE((elm)->field.tqe_next); \
547 } while (0)
548 
549 /*
550  * Circular queue definitions.
551  */
552 #define CIRCLEQ_HEAD(name, type) \
553 struct name { \
554  struct type *cqh_first; /* first element */ \
555  struct type *cqh_last; /* last element */ \
556 }
557 
558 #define CIRCLEQ_HEAD_INITIALIZER(head) \
559  { CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
560 
561 #define CIRCLEQ_ENTRY(type) \
562 struct { \
563  struct type *cqe_next; /* next element */ \
564  struct type *cqe_prev; /* previous element */ \
565 }
566 
567 /*
568  * Circular queue access methods
569  */
570 #define CIRCLEQ_FIRST(head) ((head)->cqh_first)
571 #define CIRCLEQ_LAST(head) ((head)->cqh_last)
572 #define CIRCLEQ_END(head) ((void *)(head))
573 #define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
574 #define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
575 #define CIRCLEQ_EMPTY(head) \
576  (CIRCLEQ_FIRST(head) == CIRCLEQ_END(head))
577 
578 #define CIRCLEQ_FOREACH(var, head, field) \
579  for((var) = CIRCLEQ_FIRST(head); \
580  (var) != CIRCLEQ_END(head); \
581  (var) = CIRCLEQ_NEXT(var, field))
582 
583 #define CIRCLEQ_FOREACH_SAFE(var, head, field, tvar) \
584  for ((var) = CIRCLEQ_FIRST(head); \
585  (var) != CIRCLEQ_END(head) && \
586  ((tvar) = CIRCLEQ_NEXT(var, field), 1); \
587  (var) = (tvar))
588 
589 #define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
590  for((var) = CIRCLEQ_LAST(head); \
591  (var) != CIRCLEQ_END(head); \
592  (var) = CIRCLEQ_PREV(var, field))
593 
594 #define CIRCLEQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
595  for ((var) = CIRCLEQ_LAST(head, headname); \
596  (var) != CIRCLEQ_END(head) && \
597  ((tvar) = CIRCLEQ_PREV(var, headname, field), 1); \
598  (var) = (tvar))
599 
600 /*
601  * Circular queue functions.
602  */
603 #define CIRCLEQ_INIT(head) do { \
604  (head)->cqh_first = CIRCLEQ_END(head); \
605  (head)->cqh_last = CIRCLEQ_END(head); \
606 } while (0)
607 
608 #define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
609  (elm)->field.cqe_next = (listelm)->field.cqe_next; \
610  (elm)->field.cqe_prev = (listelm); \
611  if ((listelm)->field.cqe_next == CIRCLEQ_END(head)) \
612  (head)->cqh_last = (elm); \
613  else \
614  (listelm)->field.cqe_next->field.cqe_prev = (elm); \
615  (listelm)->field.cqe_next = (elm); \
616 } while (0)
617 
618 #define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
619  (elm)->field.cqe_next = (listelm); \
620  (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
621  if ((listelm)->field.cqe_prev == CIRCLEQ_END(head)) \
622  (head)->cqh_first = (elm); \
623  else \
624  (listelm)->field.cqe_prev->field.cqe_next = (elm); \
625  (listelm)->field.cqe_prev = (elm); \
626 } while (0)
627 
628 #define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
629  (elm)->field.cqe_next = (head)->cqh_first; \
630  (elm)->field.cqe_prev = CIRCLEQ_END(head); \
631  if ((head)->cqh_last == CIRCLEQ_END(head)) \
632  (head)->cqh_last = (elm); \
633  else \
634  (head)->cqh_first->field.cqe_prev = (elm); \
635  (head)->cqh_first = (elm); \
636 } while (0)
637 
638 #define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
639  (elm)->field.cqe_next = CIRCLEQ_END(head); \
640  (elm)->field.cqe_prev = (head)->cqh_last; \
641  if ((head)->cqh_first == CIRCLEQ_END(head)) \
642  (head)->cqh_first = (elm); \
643  else \
644  (head)->cqh_last->field.cqe_next = (elm); \
645  (head)->cqh_last = (elm); \
646 } while (0)
647 
648 #define CIRCLEQ_REMOVE(head, elm, field) do { \
649  if ((elm)->field.cqe_next == CIRCLEQ_END(head)) \
650  (head)->cqh_last = (elm)->field.cqe_prev; \
651  else \
652  (elm)->field.cqe_next->field.cqe_prev = \
653  (elm)->field.cqe_prev; \
654  if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) \
655  (head)->cqh_first = (elm)->field.cqe_next; \
656  else \
657  (elm)->field.cqe_prev->field.cqe_next = \
658  (elm)->field.cqe_next; \
659  _Q_INVALIDATE((elm)->field.cqe_prev); \
660  _Q_INVALIDATE((elm)->field.cqe_next); \
661 } while (0)
662 
663 #define CIRCLEQ_REPLACE(head, elm, elm2, field) do { \
664  if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == \
665  CIRCLEQ_END(head)) \
666  (head)->cqh_last = (elm2); \
667  else \
668  (elm2)->field.cqe_next->field.cqe_prev = (elm2); \
669  if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == \
670  CIRCLEQ_END(head)) \
671  (head)->cqh_first = (elm2); \
672  else \
673  (elm2)->field.cqe_prev->field.cqe_next = (elm2); \
674  _Q_INVALIDATE((elm)->field.cqe_prev); \
675  _Q_INVALIDATE((elm)->field.cqe_next); \
676 } while (0)
677 
678 #endif /* !_SYS_QUEUE_H_ */
679 
680 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/pcg_basic.h" ***********************************/
681 
682 /*
683  * PCG Random Number Generation for C.
684  *
685  * Copyright 2014 Melissa O'Neill <oneill@pcg-random.org>
686  *
687  * Licensed under the Apache License, Version 2.0 (the "License");
688  * you may not use this file except in compliance with the License.
689  * You may obtain a copy of the License at
690  *
691  * http://www.apache.org/licenses/LICENSE-2.0
692  *
693  * Unless required by applicable law or agreed to in writing, software
694  * distributed under the License is distributed on an "AS IS" BASIS,
695  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
696  * See the License for the specific language governing permissions and
697  * limitations under the License.
698  *
699  * For additional information about the PCG random number generation scheme,
700  * including its license and other licensing options, visit
701  *
702  * http://www.pcg-random.org
703  */
704 
705 
706 
707 #if __cplusplus
708 extern "C" {
709 #endif
710 
711 typedef struct pcg_state_setseq_64 {
712  uint64_t state; // RNG state. All values are possible.
713  uint64_t inc; // Controls which RNG sequence (stream) is selected. Must *always* be odd.
715 
716 #define PCG32_INITIALIZER { 0x853c49e6748fea9bULL, 0xda3e39cb94b95bdbULL }
717 
718 void pcg32_srandom_r(pcg32_random_t* rng, uint64_t initial_state, uint64_t initseq);
719 uint32_t pcg32_random_r(pcg32_random_t* rng);
720 
721 #if __cplusplus
722 }
723 #endif
724 
725 
726 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/libc_time.h" ***********************************/
727 
728 
729 #include <limits.h>
730 #include <time.h>
731 int __secs_to_tm(long long t, struct tm *tm);
732 
733 
734 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_util.h" ***********************************/
735 
736 /* This Source Code Form is subject to the terms of the Mozilla Public
737 * License, v. 2.0. If a copy of the MPL was not distributed with this
738 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
739 
740 
741 
742 /* Assert */
743 #include <assert.h>
744 #define UA_assert(ignore) assert(ignore)
745 
746 /* BSD Queue Macros */
747 
748 /* container_of */
749 #define container_of(ptr, type, member) \
750  (type *)((uintptr_t)ptr - offsetof(type,member))
751 
752 /* Thread-Local Storage
753  * --------------------
754  * Thread-local variables are always enabled. Also when the library is built
755  * with ``UA_ENABLE_MULTITHREADING`` disabled. Otherwise, if multiple clients
756  * run in separate threads, race conditions may occur via global variables in
757  * the encoding layer. */
758 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
759 # define UA_THREAD_LOCAL _Thread_local /* C11 */
760 #elif defined(__GNUC__)
761 # define UA_THREAD_LOCAL __thread /* GNU extension */
762 #elif defined(_MSC_VER)
763 # define UA_THREAD_LOCAL __declspec(thread) /* MSVC extension */
764 #else
765 # warning The compiler does not support thread-local variables
766 # define UA_THREAD_LOCAL
767 #endif
768 
769 /* Integer Shortnames
770  * ------------------
771  * These are not exposed on the public API, since many user-applications make
772  * the same definitions in their headers. */
773 typedef UA_Byte u8;
774 typedef UA_SByte i8;
775 typedef UA_UInt16 u16;
776 typedef UA_Int16 i16;
777 typedef UA_UInt32 u32;
778 typedef UA_Int32 i32;
779 typedef UA_UInt64 u64;
780 typedef UA_Int64 i64;
782 
783 /* Atomic Operations
784  * -----------------
785  * Atomic operations that synchronize across processor cores (for
786  * multithreading). Only the inline-functions defined next are used. Replace
787  * with architecture-specific operations if necessary. */
788 #ifndef UA_ENABLE_MULTITHREADING
789 # define UA_atomic_sync()
790 #else
791 # ifdef _MSC_VER /* Visual Studio */
792 # define UA_atomic_sync() _ReadWriteBarrier()
793 # else /* GCC/Clang */
794 # define UA_atomic_sync() __sync_synchronize()
795 # endif
796 #endif
797 
798 static UA_INLINE void *
799 UA_atomic_xchg(void * volatile * addr, void *newptr) {
800 #ifndef UA_ENABLE_MULTITHREADING
801  void *old = *addr;
802  *addr = newptr;
803  return old;
804 #else
805 # ifdef _MSC_VER /* Visual Studio */
806  return _InterlockedExchangePointer(addr, newptr);
807 # else /* GCC/Clang */
808  return __sync_lock_test_and_set(addr, newptr);
809 # endif
810 #endif
811 }
812 
813 static UA_INLINE void *
814 UA_atomic_cmpxchg(void * volatile * addr, void *expected, void *newptr) {
815 #ifndef UA_ENABLE_MULTITHREADING
816  void *old = *addr;
817  if(old == expected) {
818  *addr = newptr;
819  }
820  return old;
821 #else
822 # ifdef _MSC_VER /* Visual Studio */
823  return _InterlockedCompareExchangePointer(addr, expected, newptr);
824 # else /* GCC/Clang */
825  return __sync_val_compare_and_swap(addr, expected, newptr);
826 # endif
827 #endif
828 }
829 
830 static UA_INLINE uint32_t
831 UA_atomic_add(volatile uint32_t *addr, uint32_t increase) {
832 #ifndef UA_ENABLE_MULTITHREADING
833  *addr += increase;
834  return *addr;
835 #else
836 # ifdef _MSC_VER /* Visual Studio */
837  return _InterlockedExchangeAdd(addr, increase) + increase;
838 # else /* GCC/Clang */
839  return __sync_add_and_fetch(addr, increase);
840 # endif
841 #endif
842 }
843 
844 
845 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_types_encoding_binary.h" ***********************************/
846 
847 /* This Source Code Form is subject to the terms of the Mozilla Public
848 * License, v. 2.0. If a copy of the MPL was not distributed with this
849 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
850 
851 
852 
853 typedef UA_StatusCode (*UA_exchangeEncodeBuffer)(void *handle, UA_ByteString *buf, size_t offset);
854 
856 UA_encodeBinary(const void *src, const UA_DataType *type,
857  UA_exchangeEncodeBuffer exchangeCallback, void *exchangeHandle,
858  UA_ByteString *dst, size_t *offset) UA_FUNC_ATTR_WARN_UNUSED_RESULT;
859 
861 UA_decodeBinary(const UA_ByteString *src, size_t *offset, void *dst,
863 
864 size_t UA_calcSizeBinary(void *p, const UA_DataType *type);
865 
866 
867 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_types_generated_encoding_binary.h" ***********************************/
868 
869 /* Generated from Opc.Ua.Types.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
870  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:07 */
871 
872 
873 /* Boolean */
875 UA_Boolean_encodeBinary(const UA_Boolean *src, UA_ByteString *dst, size_t *offset) {
876  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BOOLEAN], NULL, NULL, dst, offset);
877 }
879 UA_Boolean_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Boolean *dst) {
880  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BOOLEAN]);
881 }
882 
883 /* SByte */
885 UA_SByte_encodeBinary(const UA_SByte *src, UA_ByteString *dst, size_t *offset) {
886  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SBYTE], NULL, NULL, dst, offset);
887 }
889 UA_SByte_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SByte *dst) {
890  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SBYTE]);
891 }
892 
893 /* Byte */
895 UA_Byte_encodeBinary(const UA_Byte *src, UA_ByteString *dst, size_t *offset) {
896  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BYTE], NULL, NULL, dst, offset);
897 }
899 UA_Byte_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Byte *dst) {
900  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BYTE]);
901 }
902 
903 /* Int16 */
905 UA_Int16_encodeBinary(const UA_Int16 *src, UA_ByteString *dst, size_t *offset) {
906  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_INT16], NULL, NULL, dst, offset);
907 }
909 UA_Int16_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Int16 *dst) {
910  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_INT16]);
911 }
912 
913 /* UInt16 */
915 UA_UInt16_encodeBinary(const UA_UInt16 *src, UA_ByteString *dst, size_t *offset) {
916  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UINT16], NULL, NULL, dst, offset);
917 }
919 UA_UInt16_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UInt16 *dst) {
920  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UINT16]);
921 }
922 
923 /* Int32 */
925 UA_Int32_encodeBinary(const UA_Int32 *src, UA_ByteString *dst, size_t *offset) {
926  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_INT32], NULL, NULL, dst, offset);
927 }
929 UA_Int32_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Int32 *dst) {
930  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_INT32]);
931 }
932 
933 /* UInt32 */
935 UA_UInt32_encodeBinary(const UA_UInt32 *src, UA_ByteString *dst, size_t *offset) {
936  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UINT32], NULL, NULL, dst, offset);
937 }
939 UA_UInt32_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UInt32 *dst) {
940  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UINT32]);
941 }
942 
943 /* Int64 */
945 UA_Int64_encodeBinary(const UA_Int64 *src, UA_ByteString *dst, size_t *offset) {
946  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_INT64], NULL, NULL, dst, offset);
947 }
949 UA_Int64_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Int64 *dst) {
950  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_INT64]);
951 }
952 
953 /* UInt64 */
955 UA_UInt64_encodeBinary(const UA_UInt64 *src, UA_ByteString *dst, size_t *offset) {
956  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UINT64], NULL, NULL, dst, offset);
957 }
959 UA_UInt64_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UInt64 *dst) {
960  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UINT64]);
961 }
962 
963 /* Float */
965 UA_Float_encodeBinary(const UA_Float *src, UA_ByteString *dst, size_t *offset) {
966  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FLOAT], NULL, NULL, dst, offset);
967 }
969 UA_Float_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Float *dst) {
970  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FLOAT]);
971 }
972 
973 /* Double */
975 UA_Double_encodeBinary(const UA_Double *src, UA_ByteString *dst, size_t *offset) {
976  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DOUBLE], NULL, NULL, dst, offset);
977 }
979 UA_Double_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Double *dst) {
980  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DOUBLE]);
981 }
982 
983 /* String */
985 UA_String_encodeBinary(const UA_String *src, UA_ByteString *dst, size_t *offset) {
986  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_STRING], NULL, NULL, dst, offset);
987 }
989 UA_String_decodeBinary(const UA_ByteString *src, size_t *offset, UA_String *dst) {
990  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_STRING]);
991 }
992 
993 /* DateTime */
995 UA_DateTime_encodeBinary(const UA_DateTime *src, UA_ByteString *dst, size_t *offset) {
996  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATETIME], NULL, NULL, dst, offset);
997 }
999 UA_DateTime_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DateTime *dst) {
1000  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATETIME]);
1001 }
1002 
1003 /* Guid */
1004 static UA_INLINE UA_StatusCode
1005 UA_Guid_encodeBinary(const UA_Guid *src, UA_ByteString *dst, size_t *offset) {
1006  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_GUID], NULL, NULL, dst, offset);
1007 }
1008 static UA_INLINE UA_StatusCode
1009 UA_Guid_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Guid *dst) {
1010  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_GUID]);
1011 }
1012 
1013 /* ByteString */
1014 static UA_INLINE UA_StatusCode
1015 UA_ByteString_encodeBinary(const UA_ByteString *src, UA_ByteString *dst, size_t *offset) {
1016  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BYTESTRING], NULL, NULL, dst, offset);
1017 }
1018 static UA_INLINE UA_StatusCode
1019 UA_ByteString_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ByteString *dst) {
1020  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BYTESTRING]);
1021 }
1022 
1023 /* XmlElement */
1024 static UA_INLINE UA_StatusCode
1025 UA_XmlElement_encodeBinary(const UA_XmlElement *src, UA_ByteString *dst, size_t *offset) {
1026  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_XMLELEMENT], NULL, NULL, dst, offset);
1027 }
1028 static UA_INLINE UA_StatusCode
1029 UA_XmlElement_decodeBinary(const UA_ByteString *src, size_t *offset, UA_XmlElement *dst) {
1030  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_XMLELEMENT]);
1031 }
1032 
1033 /* NodeId */
1034 static UA_INLINE UA_StatusCode
1035 UA_NodeId_encodeBinary(const UA_NodeId *src, UA_ByteString *dst, size_t *offset) {
1036  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODEID], NULL, NULL, dst, offset);
1037 }
1038 static UA_INLINE UA_StatusCode
1039 UA_NodeId_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeId *dst) {
1040  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODEID]);
1041 }
1042 
1043 /* ExpandedNodeId */
1044 static UA_INLINE UA_StatusCode
1045 UA_ExpandedNodeId_encodeBinary(const UA_ExpandedNodeId *src, UA_ByteString *dst, size_t *offset) {
1046  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_EXPANDEDNODEID], NULL, NULL, dst, offset);
1047 }
1048 static UA_INLINE UA_StatusCode
1049 UA_ExpandedNodeId_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ExpandedNodeId *dst) {
1050  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_EXPANDEDNODEID]);
1051 }
1052 
1053 /* StatusCode */
1054 static UA_INLINE UA_StatusCode
1055 UA_StatusCode_encodeBinary(const UA_StatusCode *src, UA_ByteString *dst, size_t *offset) {
1056  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_STATUSCODE], NULL, NULL, dst, offset);
1057 }
1058 static UA_INLINE UA_StatusCode
1059 UA_StatusCode_decodeBinary(const UA_ByteString *src, size_t *offset, UA_StatusCode *dst) {
1060  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_STATUSCODE]);
1061 }
1062 
1063 /* QualifiedName */
1064 static UA_INLINE UA_StatusCode
1065 UA_QualifiedName_encodeBinary(const UA_QualifiedName *src, UA_ByteString *dst, size_t *offset) {
1066  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUALIFIEDNAME], NULL, NULL, dst, offset);
1067 }
1068 static UA_INLINE UA_StatusCode
1069 UA_QualifiedName_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QualifiedName *dst) {
1070  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUALIFIEDNAME]);
1071 }
1072 
1073 /* LocalizedText */
1074 static UA_INLINE UA_StatusCode
1075 UA_LocalizedText_encodeBinary(const UA_LocalizedText *src, UA_ByteString *dst, size_t *offset) {
1076  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], NULL, NULL, dst, offset);
1077 }
1078 static UA_INLINE UA_StatusCode
1079 UA_LocalizedText_decodeBinary(const UA_ByteString *src, size_t *offset, UA_LocalizedText *dst) {
1080  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
1081 }
1082 
1083 /* ExtensionObject */
1084 static UA_INLINE UA_StatusCode
1085 UA_ExtensionObject_encodeBinary(const UA_ExtensionObject *src, UA_ByteString *dst, size_t *offset) {
1086  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT], NULL, NULL, dst, offset);
1087 }
1088 static UA_INLINE UA_StatusCode
1089 UA_ExtensionObject_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ExtensionObject *dst) {
1090  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT]);
1091 }
1092 
1093 /* DataValue */
1094 static UA_INLINE UA_StatusCode
1095 UA_DataValue_encodeBinary(const UA_DataValue *src, UA_ByteString *dst, size_t *offset) {
1096  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATAVALUE], NULL, NULL, dst, offset);
1097 }
1098 static UA_INLINE UA_StatusCode
1099 UA_DataValue_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataValue *dst) {
1100  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATAVALUE]);
1101 }
1102 
1103 /* Variant */
1104 static UA_INLINE UA_StatusCode
1105 UA_Variant_encodeBinary(const UA_Variant *src, UA_ByteString *dst, size_t *offset) {
1106  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VARIANT], NULL, NULL, dst, offset);
1107 }
1108 static UA_INLINE UA_StatusCode
1109 UA_Variant_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Variant *dst) {
1110  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VARIANT]);
1111 }
1112 
1113 /* DiagnosticInfo */
1114 static UA_INLINE UA_StatusCode
1115 UA_DiagnosticInfo_encodeBinary(const UA_DiagnosticInfo *src, UA_ByteString *dst, size_t *offset) {
1116  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DIAGNOSTICINFO], NULL, NULL, dst, offset);
1117 }
1118 static UA_INLINE UA_StatusCode
1119 UA_DiagnosticInfo_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DiagnosticInfo *dst) {
1120  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DIAGNOSTICINFO]);
1121 }
1122 
1123 /* SignedSoftwareCertificate */
1124 static UA_INLINE UA_StatusCode
1125 UA_SignedSoftwareCertificate_encodeBinary(const UA_SignedSoftwareCertificate *src, UA_ByteString *dst, size_t *offset) {
1127 }
1128 static UA_INLINE UA_StatusCode
1129 UA_SignedSoftwareCertificate_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SignedSoftwareCertificate *dst) {
1130  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SIGNEDSOFTWARECERTIFICATE]);
1131 }
1132 
1133 /* BrowsePathTarget */
1134 static UA_INLINE UA_StatusCode
1135 UA_BrowsePathTarget_encodeBinary(const UA_BrowsePathTarget *src, UA_ByteString *dst, size_t *offset) {
1136  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEPATHTARGET], NULL, NULL, dst, offset);
1137 }
1138 static UA_INLINE UA_StatusCode
1139 UA_BrowsePathTarget_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowsePathTarget *dst) {
1140  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEPATHTARGET]);
1141 }
1142 
1143 /* ViewAttributes */
1144 static UA_INLINE UA_StatusCode
1145 UA_ViewAttributes_encodeBinary(const UA_ViewAttributes *src, UA_ByteString *dst, size_t *offset) {
1146  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VIEWATTRIBUTES], NULL, NULL, dst, offset);
1147 }
1148 static UA_INLINE UA_StatusCode
1149 UA_ViewAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ViewAttributes *dst) {
1150  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VIEWATTRIBUTES]);
1151 }
1152 
1153 /* BrowseResultMask */
1154 static UA_INLINE UA_StatusCode
1155 UA_BrowseResultMask_encodeBinary(const UA_BrowseResultMask *src, UA_ByteString *dst, size_t *offset) {
1156  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSERESULTMASK], NULL, NULL, dst, offset);
1157 }
1158 static UA_INLINE UA_StatusCode
1159 UA_BrowseResultMask_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseResultMask *dst) {
1160  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSERESULTMASK]);
1161 }
1162 
1163 /* RequestHeader */
1164 static UA_INLINE UA_StatusCode
1165 UA_RequestHeader_encodeBinary(const UA_RequestHeader *src, UA_ByteString *dst, size_t *offset) {
1166  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REQUESTHEADER], NULL, NULL, dst, offset);
1167 }
1168 static UA_INLINE UA_StatusCode
1169 UA_RequestHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RequestHeader *dst) {
1170  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REQUESTHEADER]);
1171 }
1172 
1173 /* MonitoredItemModifyResult */
1174 static UA_INLINE UA_StatusCode
1175 UA_MonitoredItemModifyResult_encodeBinary(const UA_MonitoredItemModifyResult *src, UA_ByteString *dst, size_t *offset) {
1177 }
1178 static UA_INLINE UA_StatusCode
1179 UA_MonitoredItemModifyResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemModifyResult *dst) {
1180  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYRESULT]);
1181 }
1182 
1183 /* CloseSecureChannelRequest */
1184 static UA_INLINE UA_StatusCode
1185 UA_CloseSecureChannelRequest_encodeBinary(const UA_CloseSecureChannelRequest *src, UA_ByteString *dst, size_t *offset) {
1187 }
1188 static UA_INLINE UA_StatusCode
1189 UA_CloseSecureChannelRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CloseSecureChannelRequest *dst) {
1190  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELREQUEST]);
1191 }
1192 
1193 /* AddNodesResult */
1194 static UA_INLINE UA_StatusCode
1195 UA_AddNodesResult_encodeBinary(const UA_AddNodesResult *src, UA_ByteString *dst, size_t *offset) {
1196  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESRESULT], NULL, NULL, dst, offset);
1197 }
1198 static UA_INLINE UA_StatusCode
1199 UA_AddNodesResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddNodesResult *dst) {
1200  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESRESULT]);
1201 }
1202 
1203 /* VariableAttributes */
1204 static UA_INLINE UA_StatusCode
1205 UA_VariableAttributes_encodeBinary(const UA_VariableAttributes *src, UA_ByteString *dst, size_t *offset) {
1206  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES], NULL, NULL, dst, offset);
1207 }
1208 static UA_INLINE UA_StatusCode
1209 UA_VariableAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_VariableAttributes *dst) {
1210  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES]);
1211 }
1212 
1213 /* NotificationMessage */
1214 static UA_INLINE UA_StatusCode
1215 UA_NotificationMessage_encodeBinary(const UA_NotificationMessage *src, UA_ByteString *dst, size_t *offset) {
1216  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NOTIFICATIONMESSAGE], NULL, NULL, dst, offset);
1217 }
1218 static UA_INLINE UA_StatusCode
1219 UA_NotificationMessage_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NotificationMessage *dst) {
1220  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NOTIFICATIONMESSAGE]);
1221 }
1222 
1223 /* NodeAttributesMask */
1224 static UA_INLINE UA_StatusCode
1225 UA_NodeAttributesMask_encodeBinary(const UA_NodeAttributesMask *src, UA_ByteString *dst, size_t *offset) {
1226  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODEATTRIBUTESMASK], NULL, NULL, dst, offset);
1227 }
1228 static UA_INLINE UA_StatusCode
1229 UA_NodeAttributesMask_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeAttributesMask *dst) {
1230  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODEATTRIBUTESMASK]);
1231 }
1232 
1233 /* MonitoringMode */
1234 static UA_INLINE UA_StatusCode
1235 UA_MonitoringMode_encodeBinary(const UA_MonitoringMode *src, UA_ByteString *dst, size_t *offset) {
1236  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MONITORINGMODE], NULL, NULL, dst, offset);
1237 }
1238 static UA_INLINE UA_StatusCode
1239 UA_MonitoringMode_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoringMode *dst) {
1240  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITORINGMODE]);
1241 }
1242 
1243 /* CallMethodResult */
1244 static UA_INLINE UA_StatusCode
1245 UA_CallMethodResult_encodeBinary(const UA_CallMethodResult *src, UA_ByteString *dst, size_t *offset) {
1246  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLMETHODRESULT], NULL, NULL, dst, offset);
1247 }
1248 static UA_INLINE UA_StatusCode
1249 UA_CallMethodResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CallMethodResult *dst) {
1250  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLMETHODRESULT]);
1251 }
1252 
1253 /* ParsingResult */
1254 static UA_INLINE UA_StatusCode
1255 UA_ParsingResult_encodeBinary(const UA_ParsingResult *src, UA_ByteString *dst, size_t *offset) {
1256  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_PARSINGRESULT], NULL, NULL, dst, offset);
1257 }
1258 static UA_INLINE UA_StatusCode
1259 UA_ParsingResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ParsingResult *dst) {
1260  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_PARSINGRESULT]);
1261 }
1262 
1263 /* RelativePathElement */
1264 static UA_INLINE UA_StatusCode
1265 UA_RelativePathElement_encodeBinary(const UA_RelativePathElement *src, UA_ByteString *dst, size_t *offset) {
1266  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT], NULL, NULL, dst, offset);
1267 }
1268 static UA_INLINE UA_StatusCode
1269 UA_RelativePathElement_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RelativePathElement *dst) {
1270  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT]);
1271 }
1272 
1273 /* BrowseDirection */
1274 static UA_INLINE UA_StatusCode
1275 UA_BrowseDirection_encodeBinary(const UA_BrowseDirection *src, UA_ByteString *dst, size_t *offset) {
1276  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEDIRECTION], NULL, NULL, dst, offset);
1277 }
1278 static UA_INLINE UA_StatusCode
1279 UA_BrowseDirection_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseDirection *dst) {
1280  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEDIRECTION]);
1281 }
1282 
1283 /* CallMethodRequest */
1284 static UA_INLINE UA_StatusCode
1285 UA_CallMethodRequest_encodeBinary(const UA_CallMethodRequest *src, UA_ByteString *dst, size_t *offset) {
1286  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLMETHODREQUEST], NULL, NULL, dst, offset);
1287 }
1288 static UA_INLINE UA_StatusCode
1289 UA_CallMethodRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CallMethodRequest *dst) {
1290  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLMETHODREQUEST]);
1291 }
1292 
1293 /* UnregisterNodesRequest */
1294 static UA_INLINE UA_StatusCode
1295 UA_UnregisterNodesRequest_encodeBinary(const UA_UnregisterNodesRequest *src, UA_ByteString *dst, size_t *offset) {
1296  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST], NULL, NULL, dst, offset);
1297 }
1298 static UA_INLINE UA_StatusCode
1299 UA_UnregisterNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UnregisterNodesRequest *dst) {
1300  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST]);
1301 }
1302 
1303 /* ContentFilterElementResult */
1304 static UA_INLINE UA_StatusCode
1305 UA_ContentFilterElementResult_encodeBinary(const UA_ContentFilterElementResult *src, UA_ByteString *dst, size_t *offset) {
1307 }
1308 static UA_INLINE UA_StatusCode
1309 UA_ContentFilterElementResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ContentFilterElementResult *dst) {
1310  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENTRESULT]);
1311 }
1312 
1313 /* QueryDataSet */
1314 static UA_INLINE UA_StatusCode
1315 UA_QueryDataSet_encodeBinary(const UA_QueryDataSet *src, UA_ByteString *dst, size_t *offset) {
1316  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYDATASET], NULL, NULL, dst, offset);
1317 }
1318 static UA_INLINE UA_StatusCode
1319 UA_QueryDataSet_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryDataSet *dst) {
1320  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYDATASET]);
1321 }
1322 
1323 /* AnonymousIdentityToken */
1324 static UA_INLINE UA_StatusCode
1325 UA_AnonymousIdentityToken_encodeBinary(const UA_AnonymousIdentityToken *src, UA_ByteString *dst, size_t *offset) {
1326  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ANONYMOUSIDENTITYTOKEN], NULL, NULL, dst, offset);
1327 }
1328 static UA_INLINE UA_StatusCode
1329 UA_AnonymousIdentityToken_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AnonymousIdentityToken *dst) {
1330  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ANONYMOUSIDENTITYTOKEN]);
1331 }
1332 
1333 /* SetPublishingModeRequest */
1334 static UA_INLINE UA_StatusCode
1335 UA_SetPublishingModeRequest_encodeBinary(const UA_SetPublishingModeRequest *src, UA_ByteString *dst, size_t *offset) {
1336  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST], NULL, NULL, dst, offset);
1337 }
1338 static UA_INLINE UA_StatusCode
1339 UA_SetPublishingModeRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SetPublishingModeRequest *dst) {
1340  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST]);
1341 }
1342 
1343 /* TimestampsToReturn */
1344 static UA_INLINE UA_StatusCode
1345 UA_TimestampsToReturn_encodeBinary(const UA_TimestampsToReturn *src, UA_ByteString *dst, size_t *offset) {
1346  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_TIMESTAMPSTORETURN], NULL, NULL, dst, offset);
1347 }
1348 static UA_INLINE UA_StatusCode
1349 UA_TimestampsToReturn_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TimestampsToReturn *dst) {
1350  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_TIMESTAMPSTORETURN]);
1351 }
1352 
1353 /* CallRequest */
1354 static UA_INLINE UA_StatusCode
1355 UA_CallRequest_encodeBinary(const UA_CallRequest *src, UA_ByteString *dst, size_t *offset) {
1356  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLREQUEST], NULL, NULL, dst, offset);
1357 }
1358 static UA_INLINE UA_StatusCode
1359 UA_CallRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CallRequest *dst) {
1360  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLREQUEST]);
1361 }
1362 
1363 /* MethodAttributes */
1364 static UA_INLINE UA_StatusCode
1365 UA_MethodAttributes_encodeBinary(const UA_MethodAttributes *src, UA_ByteString *dst, size_t *offset) {
1366  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_METHODATTRIBUTES], NULL, NULL, dst, offset);
1367 }
1368 static UA_INLINE UA_StatusCode
1369 UA_MethodAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MethodAttributes *dst) {
1370  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_METHODATTRIBUTES]);
1371 }
1372 
1373 /* DeleteReferencesItem */
1374 static UA_INLINE UA_StatusCode
1375 UA_DeleteReferencesItem_encodeBinary(const UA_DeleteReferencesItem *src, UA_ByteString *dst, size_t *offset) {
1376  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETEREFERENCESITEM], NULL, NULL, dst, offset);
1377 }
1378 static UA_INLINE UA_StatusCode
1379 UA_DeleteReferencesItem_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteReferencesItem *dst) {
1380  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESITEM]);
1381 }
1382 
1383 /* WriteValue */
1384 static UA_INLINE UA_StatusCode
1385 UA_WriteValue_encodeBinary(const UA_WriteValue *src, UA_ByteString *dst, size_t *offset) {
1386  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_WRITEVALUE], NULL, NULL, dst, offset);
1387 }
1388 static UA_INLINE UA_StatusCode
1389 UA_WriteValue_decodeBinary(const UA_ByteString *src, size_t *offset, UA_WriteValue *dst) {
1390  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_WRITEVALUE]);
1391 }
1392 
1393 /* MonitoredItemCreateResult */
1394 static UA_INLINE UA_StatusCode
1395 UA_MonitoredItemCreateResult_encodeBinary(const UA_MonitoredItemCreateResult *src, UA_ByteString *dst, size_t *offset) {
1397 }
1398 static UA_INLINE UA_StatusCode
1399 UA_MonitoredItemCreateResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemCreateResult *dst) {
1400  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATERESULT]);
1401 }
1402 
1403 /* MessageSecurityMode */
1404 static UA_INLINE UA_StatusCode
1405 UA_MessageSecurityMode_encodeBinary(const UA_MessageSecurityMode *src, UA_ByteString *dst, size_t *offset) {
1406  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MESSAGESECURITYMODE], NULL, NULL, dst, offset);
1407 }
1408 static UA_INLINE UA_StatusCode
1409 UA_MessageSecurityMode_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MessageSecurityMode *dst) {
1410  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MESSAGESECURITYMODE]);
1411 }
1412 
1413 /* MonitoringParameters */
1414 static UA_INLINE UA_StatusCode
1415 UA_MonitoringParameters_encodeBinary(const UA_MonitoringParameters *src, UA_ByteString *dst, size_t *offset) {
1416  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MONITORINGPARAMETERS], NULL, NULL, dst, offset);
1417 }
1418 static UA_INLINE UA_StatusCode
1419 UA_MonitoringParameters_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoringParameters *dst) {
1420  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITORINGPARAMETERS]);
1421 }
1422 
1423 /* SignatureData */
1424 static UA_INLINE UA_StatusCode
1425 UA_SignatureData_encodeBinary(const UA_SignatureData *src, UA_ByteString *dst, size_t *offset) {
1426  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SIGNATUREDATA], NULL, NULL, dst, offset);
1427 }
1428 static UA_INLINE UA_StatusCode
1429 UA_SignatureData_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SignatureData *dst) {
1430  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SIGNATUREDATA]);
1431 }
1432 
1433 /* ReferenceNode */
1434 static UA_INLINE UA_StatusCode
1435 UA_ReferenceNode_encodeBinary(const UA_ReferenceNode *src, UA_ByteString *dst, size_t *offset) {
1436  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REFERENCENODE], NULL, NULL, dst, offset);
1437 }
1438 static UA_INLINE UA_StatusCode
1439 UA_ReferenceNode_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReferenceNode *dst) {
1440  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REFERENCENODE]);
1441 }
1442 
1443 /* Argument */
1444 static UA_INLINE UA_StatusCode
1445 UA_Argument_encodeBinary(const UA_Argument *src, UA_ByteString *dst, size_t *offset) {
1446  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ARGUMENT], NULL, NULL, dst, offset);
1447 }
1448 static UA_INLINE UA_StatusCode
1449 UA_Argument_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Argument *dst) {
1450  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ARGUMENT]);
1451 }
1452 
1453 /* UserIdentityToken */
1454 static UA_INLINE UA_StatusCode
1455 UA_UserIdentityToken_encodeBinary(const UA_UserIdentityToken *src, UA_ByteString *dst, size_t *offset) {
1456  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERIDENTITYTOKEN], NULL, NULL, dst, offset);
1457 }
1458 static UA_INLINE UA_StatusCode
1459 UA_UserIdentityToken_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UserIdentityToken *dst) {
1460  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERIDENTITYTOKEN]);
1461 }
1462 
1463 /* ObjectTypeAttributes */
1464 static UA_INLINE UA_StatusCode
1465 UA_ObjectTypeAttributes_encodeBinary(const UA_ObjectTypeAttributes *src, UA_ByteString *dst, size_t *offset) {
1466  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES], NULL, NULL, dst, offset);
1467 }
1468 static UA_INLINE UA_StatusCode
1469 UA_ObjectTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ObjectTypeAttributes *dst) {
1470  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES]);
1471 }
1472 
1473 /* DeadbandType */
1474 static UA_INLINE UA_StatusCode
1475 UA_DeadbandType_encodeBinary(const UA_DeadbandType *src, UA_ByteString *dst, size_t *offset) {
1476  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DEADBANDTYPE], NULL, NULL, dst, offset);
1477 }
1478 static UA_INLINE UA_StatusCode
1479 UA_DeadbandType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeadbandType *dst) {
1480  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DEADBANDTYPE]);
1481 }
1482 
1483 /* SecurityTokenRequestType */
1484 static UA_INLINE UA_StatusCode
1485 UA_SecurityTokenRequestType_encodeBinary(const UA_SecurityTokenRequestType *src, UA_ByteString *dst, size_t *offset) {
1486  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SECURITYTOKENREQUESTTYPE], NULL, NULL, dst, offset);
1487 }
1488 static UA_INLINE UA_StatusCode
1489 UA_SecurityTokenRequestType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SecurityTokenRequestType *dst) {
1490  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SECURITYTOKENREQUESTTYPE]);
1491 }
1492 
1493 /* DataChangeTrigger */
1494 static UA_INLINE UA_StatusCode
1495 UA_DataChangeTrigger_encodeBinary(const UA_DataChangeTrigger *src, UA_ByteString *dst, size_t *offset) {
1496  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATACHANGETRIGGER], NULL, NULL, dst, offset);
1497 }
1498 static UA_INLINE UA_StatusCode
1499 UA_DataChangeTrigger_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataChangeTrigger *dst) {
1500  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATACHANGETRIGGER]);
1501 }
1502 
1503 /* BuildInfo */
1504 static UA_INLINE UA_StatusCode
1505 UA_BuildInfo_encodeBinary(const UA_BuildInfo *src, UA_ByteString *dst, size_t *offset) {
1506  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BUILDINFO], NULL, NULL, dst, offset);
1507 }
1508 static UA_INLINE UA_StatusCode
1509 UA_BuildInfo_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BuildInfo *dst) {
1510  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BUILDINFO]);
1511 }
1512 
1513 /* NodeClass */
1514 static UA_INLINE UA_StatusCode
1515 UA_NodeClass_encodeBinary(const UA_NodeClass *src, UA_ByteString *dst, size_t *offset) {
1516  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODECLASS], NULL, NULL, dst, offset);
1517 }
1518 static UA_INLINE UA_StatusCode
1519 UA_NodeClass_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeClass *dst) {
1520  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODECLASS]);
1521 }
1522 
1523 /* ChannelSecurityToken */
1524 static UA_INLINE UA_StatusCode
1525 UA_ChannelSecurityToken_encodeBinary(const UA_ChannelSecurityToken *src, UA_ByteString *dst, size_t *offset) {
1526  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CHANNELSECURITYTOKEN], NULL, NULL, dst, offset);
1527 }
1528 static UA_INLINE UA_StatusCode
1529 UA_ChannelSecurityToken_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ChannelSecurityToken *dst) {
1530  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CHANNELSECURITYTOKEN]);
1531 }
1532 
1533 /* MonitoredItemNotification */
1534 static UA_INLINE UA_StatusCode
1535 UA_MonitoredItemNotification_encodeBinary(const UA_MonitoredItemNotification *src, UA_ByteString *dst, size_t *offset) {
1537 }
1538 static UA_INLINE UA_StatusCode
1539 UA_MonitoredItemNotification_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemNotification *dst) {
1540  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMNOTIFICATION]);
1541 }
1542 
1543 /* DeleteNodesItem */
1544 static UA_INLINE UA_StatusCode
1545 UA_DeleteNodesItem_encodeBinary(const UA_DeleteNodesItem *src, UA_ByteString *dst, size_t *offset) {
1546  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETENODESITEM], NULL, NULL, dst, offset);
1547 }
1548 static UA_INLINE UA_StatusCode
1549 UA_DeleteNodesItem_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteNodesItem *dst) {
1550  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETENODESITEM]);
1551 }
1552 
1553 /* SubscriptionAcknowledgement */
1554 static UA_INLINE UA_StatusCode
1555 UA_SubscriptionAcknowledgement_encodeBinary(const UA_SubscriptionAcknowledgement *src, UA_ByteString *dst, size_t *offset) {
1557 }
1558 static UA_INLINE UA_StatusCode
1559 UA_SubscriptionAcknowledgement_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SubscriptionAcknowledgement *dst) {
1561 }
1562 
1563 /* ReadValueId */
1564 static UA_INLINE UA_StatusCode
1565 UA_ReadValueId_encodeBinary(const UA_ReadValueId *src, UA_ByteString *dst, size_t *offset) {
1566  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_READVALUEID], NULL, NULL, dst, offset);
1567 }
1568 static UA_INLINE UA_StatusCode
1569 UA_ReadValueId_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReadValueId *dst) {
1570  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_READVALUEID]);
1571 }
1572 
1573 /* DataTypeAttributes */
1574 static UA_INLINE UA_StatusCode
1575 UA_DataTypeAttributes_encodeBinary(const UA_DataTypeAttributes *src, UA_ByteString *dst, size_t *offset) {
1576  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES], NULL, NULL, dst, offset);
1577 }
1578 static UA_INLINE UA_StatusCode
1579 UA_DataTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataTypeAttributes *dst) {
1580  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES]);
1581 }
1582 
1583 /* ResponseHeader */
1584 static UA_INLINE UA_StatusCode
1585 UA_ResponseHeader_encodeBinary(const UA_ResponseHeader *src, UA_ByteString *dst, size_t *offset) {
1586  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_RESPONSEHEADER], NULL, NULL, dst, offset);
1587 }
1588 static UA_INLINE UA_StatusCode
1589 UA_ResponseHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ResponseHeader *dst) {
1590  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_RESPONSEHEADER]);
1591 }
1592 
1593 /* DeleteSubscriptionsRequest */
1594 static UA_INLINE UA_StatusCode
1595 UA_DeleteSubscriptionsRequest_encodeBinary(const UA_DeleteSubscriptionsRequest *src, UA_ByteString *dst, size_t *offset) {
1597 }
1598 static UA_INLINE UA_StatusCode
1599 UA_DeleteSubscriptionsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteSubscriptionsRequest *dst) {
1600  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST]);
1601 }
1602 
1603 /* ViewDescription */
1604 static UA_INLINE UA_StatusCode
1605 UA_ViewDescription_encodeBinary(const UA_ViewDescription *src, UA_ByteString *dst, size_t *offset) {
1606  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VIEWDESCRIPTION], NULL, NULL, dst, offset);
1607 }
1608 static UA_INLINE UA_StatusCode
1609 UA_ViewDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ViewDescription *dst) {
1610  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VIEWDESCRIPTION]);
1611 }
1612 
1613 /* DeleteMonitoredItemsResponse */
1614 static UA_INLINE UA_StatusCode
1615 UA_DeleteMonitoredItemsResponse_encodeBinary(const UA_DeleteMonitoredItemsResponse *src, UA_ByteString *dst, size_t *offset) {
1617 }
1618 static UA_INLINE UA_StatusCode
1619 UA_DeleteMonitoredItemsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteMonitoredItemsResponse *dst) {
1621 }
1622 
1623 /* NodeAttributes */
1624 static UA_INLINE UA_StatusCode
1625 UA_NodeAttributes_encodeBinary(const UA_NodeAttributes *src, UA_ByteString *dst, size_t *offset) {
1626  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODEATTRIBUTES], NULL, NULL, dst, offset);
1627 }
1628 static UA_INLINE UA_StatusCode
1629 UA_NodeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeAttributes *dst) {
1630  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODEATTRIBUTES]);
1631 }
1632 
1633 /* RegisterNodesRequest */
1634 static UA_INLINE UA_StatusCode
1635 UA_RegisterNodesRequest_encodeBinary(const UA_RegisterNodesRequest *src, UA_ByteString *dst, size_t *offset) {
1636  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST], NULL, NULL, dst, offset);
1637 }
1638 static UA_INLINE UA_StatusCode
1639 UA_RegisterNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RegisterNodesRequest *dst) {
1640  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST]);
1641 }
1642 
1643 /* DeleteNodesRequest */
1644 static UA_INLINE UA_StatusCode
1645 UA_DeleteNodesRequest_encodeBinary(const UA_DeleteNodesRequest *src, UA_ByteString *dst, size_t *offset) {
1646  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETENODESREQUEST], NULL, NULL, dst, offset);
1647 }
1648 static UA_INLINE UA_StatusCode
1649 UA_DeleteNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteNodesRequest *dst) {
1650  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETENODESREQUEST]);
1651 }
1652 
1653 /* PublishResponse */
1654 static UA_INLINE UA_StatusCode
1655 UA_PublishResponse_encodeBinary(const UA_PublishResponse *src, UA_ByteString *dst, size_t *offset) {
1656  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_PUBLISHRESPONSE], NULL, NULL, dst, offset);
1657 }
1658 static UA_INLINE UA_StatusCode
1659 UA_PublishResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_PublishResponse *dst) {
1660  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_PUBLISHRESPONSE]);
1661 }
1662 
1663 /* MonitoredItemModifyRequest */
1664 static UA_INLINE UA_StatusCode
1665 UA_MonitoredItemModifyRequest_encodeBinary(const UA_MonitoredItemModifyRequest *src, UA_ByteString *dst, size_t *offset) {
1667 }
1668 static UA_INLINE UA_StatusCode
1669 UA_MonitoredItemModifyRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemModifyRequest *dst) {
1670  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYREQUEST]);
1671 }
1672 
1673 /* UserNameIdentityToken */
1674 static UA_INLINE UA_StatusCode
1675 UA_UserNameIdentityToken_encodeBinary(const UA_UserNameIdentityToken *src, UA_ByteString *dst, size_t *offset) {
1676  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN], NULL, NULL, dst, offset);
1677 }
1678 static UA_INLINE UA_StatusCode
1679 UA_UserNameIdentityToken_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UserNameIdentityToken *dst) {
1680  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN]);
1681 }
1682 
1683 /* IdType */
1684 static UA_INLINE UA_StatusCode
1685 UA_IdType_encodeBinary(const UA_IdType *src, UA_ByteString *dst, size_t *offset) {
1686  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_IDTYPE], NULL, NULL, dst, offset);
1687 }
1688 static UA_INLINE UA_StatusCode
1689 UA_IdType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_IdType *dst) {
1690  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_IDTYPE]);
1691 }
1692 
1693 /* UserTokenType */
1694 static UA_INLINE UA_StatusCode
1695 UA_UserTokenType_encodeBinary(const UA_UserTokenType *src, UA_ByteString *dst, size_t *offset) {
1696  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERTOKENTYPE], NULL, NULL, dst, offset);
1697 }
1698 static UA_INLINE UA_StatusCode
1699 UA_UserTokenType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UserTokenType *dst) {
1700  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERTOKENTYPE]);
1701 }
1702 
1703 /* ActivateSessionRequest */
1704 static UA_INLINE UA_StatusCode
1705 UA_ActivateSessionRequest_encodeBinary(const UA_ActivateSessionRequest *src, UA_ByteString *dst, size_t *offset) {
1706  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST], NULL, NULL, dst, offset);
1707 }
1708 static UA_INLINE UA_StatusCode
1709 UA_ActivateSessionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ActivateSessionRequest *dst) {
1710  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST]);
1711 }
1712 
1713 /* OpenSecureChannelResponse */
1714 static UA_INLINE UA_StatusCode
1715 UA_OpenSecureChannelResponse_encodeBinary(const UA_OpenSecureChannelResponse *src, UA_ByteString *dst, size_t *offset) {
1717 }
1718 static UA_INLINE UA_StatusCode
1719 UA_OpenSecureChannelResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_OpenSecureChannelResponse *dst) {
1720  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE]);
1721 }
1722 
1723 /* ApplicationType */
1724 static UA_INLINE UA_StatusCode
1725 UA_ApplicationType_encodeBinary(const UA_ApplicationType *src, UA_ByteString *dst, size_t *offset) {
1726  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_APPLICATIONTYPE], NULL, NULL, dst, offset);
1727 }
1728 static UA_INLINE UA_StatusCode
1729 UA_ApplicationType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ApplicationType *dst) {
1730  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_APPLICATIONTYPE]);
1731 }
1732 
1733 /* ServerState */
1734 static UA_INLINE UA_StatusCode
1735 UA_ServerState_encodeBinary(const UA_ServerState *src, UA_ByteString *dst, size_t *offset) {
1736  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVERSTATE], NULL, NULL, dst, offset);
1737 }
1738 static UA_INLINE UA_StatusCode
1739 UA_ServerState_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ServerState *dst) {
1740  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVERSTATE]);
1741 }
1742 
1743 /* QueryNextResponse */
1744 static UA_INLINE UA_StatusCode
1745 UA_QueryNextResponse_encodeBinary(const UA_QueryNextResponse *src, UA_ByteString *dst, size_t *offset) {
1746  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYNEXTRESPONSE], NULL, NULL, dst, offset);
1747 }
1748 static UA_INLINE UA_StatusCode
1749 UA_QueryNextResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryNextResponse *dst) {
1750  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYNEXTRESPONSE]);
1751 }
1752 
1753 /* ActivateSessionResponse */
1754 static UA_INLINE UA_StatusCode
1755 UA_ActivateSessionResponse_encodeBinary(const UA_ActivateSessionResponse *src, UA_ByteString *dst, size_t *offset) {
1756  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE], NULL, NULL, dst, offset);
1757 }
1758 static UA_INLINE UA_StatusCode
1759 UA_ActivateSessionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ActivateSessionResponse *dst) {
1760  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE]);
1761 }
1762 
1763 /* FilterOperator */
1764 static UA_INLINE UA_StatusCode
1765 UA_FilterOperator_encodeBinary(const UA_FilterOperator *src, UA_ByteString *dst, size_t *offset) {
1766  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FILTEROPERATOR], NULL, NULL, dst, offset);
1767 }
1768 static UA_INLINE UA_StatusCode
1769 UA_FilterOperator_decodeBinary(const UA_ByteString *src, size_t *offset, UA_FilterOperator *dst) {
1770  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FILTEROPERATOR]);
1771 }
1772 
1773 /* QueryNextRequest */
1774 static UA_INLINE UA_StatusCode
1775 UA_QueryNextRequest_encodeBinary(const UA_QueryNextRequest *src, UA_ByteString *dst, size_t *offset) {
1776  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYNEXTREQUEST], NULL, NULL, dst, offset);
1777 }
1778 static UA_INLINE UA_StatusCode
1779 UA_QueryNextRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryNextRequest *dst) {
1780  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYNEXTREQUEST]);
1781 }
1782 
1783 /* WriteResponse */
1784 static UA_INLINE UA_StatusCode
1785 UA_WriteResponse_encodeBinary(const UA_WriteResponse *src, UA_ByteString *dst, size_t *offset) {
1786  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_WRITERESPONSE], NULL, NULL, dst, offset);
1787 }
1788 static UA_INLINE UA_StatusCode
1789 UA_WriteResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_WriteResponse *dst) {
1790  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_WRITERESPONSE]);
1791 }
1792 
1793 /* BrowseNextRequest */
1794 static UA_INLINE UA_StatusCode
1795 UA_BrowseNextRequest_encodeBinary(const UA_BrowseNextRequest *src, UA_ByteString *dst, size_t *offset) {
1796  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST], NULL, NULL, dst, offset);
1797 }
1798 static UA_INLINE UA_StatusCode
1799 UA_BrowseNextRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseNextRequest *dst) {
1800  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST]);
1801 }
1802 
1803 /* CreateSubscriptionRequest */
1804 static UA_INLINE UA_StatusCode
1805 UA_CreateSubscriptionRequest_encodeBinary(const UA_CreateSubscriptionRequest *src, UA_ByteString *dst, size_t *offset) {
1807 }
1808 static UA_INLINE UA_StatusCode
1809 UA_CreateSubscriptionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateSubscriptionRequest *dst) {
1810  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST]);
1811 }
1812 
1813 /* VariableTypeAttributes */
1814 static UA_INLINE UA_StatusCode
1815 UA_VariableTypeAttributes_encodeBinary(const UA_VariableTypeAttributes *src, UA_ByteString *dst, size_t *offset) {
1816  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES], NULL, NULL, dst, offset);
1817 }
1818 static UA_INLINE UA_StatusCode
1819 UA_VariableTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_VariableTypeAttributes *dst) {
1820  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES]);
1821 }
1822 
1823 /* BrowsePathResult */
1824 static UA_INLINE UA_StatusCode
1825 UA_BrowsePathResult_encodeBinary(const UA_BrowsePathResult *src, UA_ByteString *dst, size_t *offset) {
1826  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEPATHRESULT], NULL, NULL, dst, offset);
1827 }
1828 static UA_INLINE UA_StatusCode
1829 UA_BrowsePathResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowsePathResult *dst) {
1830  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEPATHRESULT]);
1831 }
1832 
1833 /* ModifySubscriptionResponse */
1834 static UA_INLINE UA_StatusCode
1835 UA_ModifySubscriptionResponse_encodeBinary(const UA_ModifySubscriptionResponse *src, UA_ByteString *dst, size_t *offset) {
1837 }
1838 static UA_INLINE UA_StatusCode
1839 UA_ModifySubscriptionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ModifySubscriptionResponse *dst) {
1840  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE]);
1841 }
1842 
1843 /* OpenSecureChannelRequest */
1844 static UA_INLINE UA_StatusCode
1845 UA_OpenSecureChannelRequest_encodeBinary(const UA_OpenSecureChannelRequest *src, UA_ByteString *dst, size_t *offset) {
1846  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST], NULL, NULL, dst, offset);
1847 }
1848 static UA_INLINE UA_StatusCode
1849 UA_OpenSecureChannelRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_OpenSecureChannelRequest *dst) {
1850  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST]);
1851 }
1852 
1853 /* RegisterNodesResponse */
1854 static UA_INLINE UA_StatusCode
1855 UA_RegisterNodesResponse_encodeBinary(const UA_RegisterNodesResponse *src, UA_ByteString *dst, size_t *offset) {
1856  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE], NULL, NULL, dst, offset);
1857 }
1858 static UA_INLINE UA_StatusCode
1859 UA_RegisterNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RegisterNodesResponse *dst) {
1860  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE]);
1861 }
1862 
1863 /* CloseSessionRequest */
1864 static UA_INLINE UA_StatusCode
1865 UA_CloseSessionRequest_encodeBinary(const UA_CloseSessionRequest *src, UA_ByteString *dst, size_t *offset) {
1866  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST], NULL, NULL, dst, offset);
1867 }
1868 static UA_INLINE UA_StatusCode
1869 UA_CloseSessionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CloseSessionRequest *dst) {
1870  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST]);
1871 }
1872 
1873 /* ModifySubscriptionRequest */
1874 static UA_INLINE UA_StatusCode
1875 UA_ModifySubscriptionRequest_encodeBinary(const UA_ModifySubscriptionRequest *src, UA_ByteString *dst, size_t *offset) {
1877 }
1878 static UA_INLINE UA_StatusCode
1879 UA_ModifySubscriptionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ModifySubscriptionRequest *dst) {
1880  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST]);
1881 }
1882 
1883 /* UserTokenPolicy */
1884 static UA_INLINE UA_StatusCode
1885 UA_UserTokenPolicy_encodeBinary(const UA_UserTokenPolicy *src, UA_ByteString *dst, size_t *offset) {
1886  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERTOKENPOLICY], NULL, NULL, dst, offset);
1887 }
1888 static UA_INLINE UA_StatusCode
1889 UA_UserTokenPolicy_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UserTokenPolicy *dst) {
1890  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERTOKENPOLICY]);
1891 }
1892 
1893 /* DeleteMonitoredItemsRequest */
1894 static UA_INLINE UA_StatusCode
1895 UA_DeleteMonitoredItemsRequest_encodeBinary(const UA_DeleteMonitoredItemsRequest *src, UA_ByteString *dst, size_t *offset) {
1897 }
1898 static UA_INLINE UA_StatusCode
1899 UA_DeleteMonitoredItemsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteMonitoredItemsRequest *dst) {
1901 }
1902 
1903 /* ReferenceTypeAttributes */
1904 static UA_INLINE UA_StatusCode
1905 UA_ReferenceTypeAttributes_encodeBinary(const UA_ReferenceTypeAttributes *src, UA_ByteString *dst, size_t *offset) {
1906  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES], NULL, NULL, dst, offset);
1907 }
1908 static UA_INLINE UA_StatusCode
1909 UA_ReferenceTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReferenceTypeAttributes *dst) {
1910  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES]);
1911 }
1912 
1913 /* SetMonitoringModeRequest */
1914 static UA_INLINE UA_StatusCode
1915 UA_SetMonitoringModeRequest_encodeBinary(const UA_SetMonitoringModeRequest *src, UA_ByteString *dst, size_t *offset) {
1916  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST], NULL, NULL, dst, offset);
1917 }
1918 static UA_INLINE UA_StatusCode
1919 UA_SetMonitoringModeRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SetMonitoringModeRequest *dst) {
1920  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST]);
1921 }
1922 
1923 /* UnregisterNodesResponse */
1924 static UA_INLINE UA_StatusCode
1925 UA_UnregisterNodesResponse_encodeBinary(const UA_UnregisterNodesResponse *src, UA_ByteString *dst, size_t *offset) {
1926  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE], NULL, NULL, dst, offset);
1927 }
1928 static UA_INLINE UA_StatusCode
1929 UA_UnregisterNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UnregisterNodesResponse *dst) {
1930  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE]);
1931 }
1932 
1933 /* WriteRequest */
1934 static UA_INLINE UA_StatusCode
1935 UA_WriteRequest_encodeBinary(const UA_WriteRequest *src, UA_ByteString *dst, size_t *offset) {
1936  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_WRITEREQUEST], NULL, NULL, dst, offset);
1937 }
1938 static UA_INLINE UA_StatusCode
1939 UA_WriteRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_WriteRequest *dst) {
1940  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_WRITEREQUEST]);
1941 }
1942 
1943 /* ObjectAttributes */
1944 static UA_INLINE UA_StatusCode
1945 UA_ObjectAttributes_encodeBinary(const UA_ObjectAttributes *src, UA_ByteString *dst, size_t *offset) {
1946  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES], NULL, NULL, dst, offset);
1947 }
1948 static UA_INLINE UA_StatusCode
1949 UA_ObjectAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ObjectAttributes *dst) {
1950  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES]);
1951 }
1952 
1953 /* BrowseDescription */
1954 static UA_INLINE UA_StatusCode
1955 UA_BrowseDescription_encodeBinary(const UA_BrowseDescription *src, UA_ByteString *dst, size_t *offset) {
1956  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEDESCRIPTION], NULL, NULL, dst, offset);
1957 }
1958 static UA_INLINE UA_StatusCode
1959 UA_BrowseDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseDescription *dst) {
1960  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEDESCRIPTION]);
1961 }
1962 
1963 /* RepublishRequest */
1964 static UA_INLINE UA_StatusCode
1965 UA_RepublishRequest_encodeBinary(const UA_RepublishRequest *src, UA_ByteString *dst, size_t *offset) {
1966  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REPUBLISHREQUEST], NULL, NULL, dst, offset);
1967 }
1968 static UA_INLINE UA_StatusCode
1969 UA_RepublishRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RepublishRequest *dst) {
1970  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REPUBLISHREQUEST]);
1971 }
1972 
1973 /* GetEndpointsRequest */
1974 static UA_INLINE UA_StatusCode
1975 UA_GetEndpointsRequest_encodeBinary(const UA_GetEndpointsRequest *src, UA_ByteString *dst, size_t *offset) {
1976  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST], NULL, NULL, dst, offset);
1977 }
1978 static UA_INLINE UA_StatusCode
1979 UA_GetEndpointsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_GetEndpointsRequest *dst) {
1980  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST]);
1981 }
1982 
1983 /* PublishRequest */
1984 static UA_INLINE UA_StatusCode
1985 UA_PublishRequest_encodeBinary(const UA_PublishRequest *src, UA_ByteString *dst, size_t *offset) {
1986  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_PUBLISHREQUEST], NULL, NULL, dst, offset);
1987 }
1988 static UA_INLINE UA_StatusCode
1989 UA_PublishRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_PublishRequest *dst) {
1990  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_PUBLISHREQUEST]);
1991 }
1992 
1993 /* AddNodesResponse */
1994 static UA_INLINE UA_StatusCode
1995 UA_AddNodesResponse_encodeBinary(const UA_AddNodesResponse *src, UA_ByteString *dst, size_t *offset) {
1996  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESRESPONSE], NULL, NULL, dst, offset);
1997 }
1998 static UA_INLINE UA_StatusCode
1999 UA_AddNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddNodesResponse *dst) {
2000  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESRESPONSE]);
2001 }
2002 
2003 /* DataChangeNotification */
2004 static UA_INLINE UA_StatusCode
2005 UA_DataChangeNotification_encodeBinary(const UA_DataChangeNotification *src, UA_ByteString *dst, size_t *offset) {
2006  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATACHANGENOTIFICATION], NULL, NULL, dst, offset);
2007 }
2008 static UA_INLINE UA_StatusCode
2009 UA_DataChangeNotification_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataChangeNotification *dst) {
2010  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATACHANGENOTIFICATION]);
2011 }
2012 
2013 /* CloseSecureChannelResponse */
2014 static UA_INLINE UA_StatusCode
2015 UA_CloseSecureChannelResponse_encodeBinary(const UA_CloseSecureChannelResponse *src, UA_ByteString *dst, size_t *offset) {
2017 }
2018 static UA_INLINE UA_StatusCode
2019 UA_CloseSecureChannelResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CloseSecureChannelResponse *dst) {
2020  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELRESPONSE]);
2021 }
2022 
2023 /* ModifyMonitoredItemsRequest */
2024 static UA_INLINE UA_StatusCode
2025 UA_ModifyMonitoredItemsRequest_encodeBinary(const UA_ModifyMonitoredItemsRequest *src, UA_ByteString *dst, size_t *offset) {
2027 }
2028 static UA_INLINE UA_StatusCode
2029 UA_ModifyMonitoredItemsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ModifyMonitoredItemsRequest *dst) {
2031 }
2032 
2033 /* SetMonitoringModeResponse */
2034 static UA_INLINE UA_StatusCode
2035 UA_SetMonitoringModeResponse_encodeBinary(const UA_SetMonitoringModeResponse *src, UA_ByteString *dst, size_t *offset) {
2037 }
2038 static UA_INLINE UA_StatusCode
2039 UA_SetMonitoringModeResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SetMonitoringModeResponse *dst) {
2040  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETMONITORINGMODERESPONSE]);
2041 }
2042 
2043 /* FindServersRequest */
2044 static UA_INLINE UA_StatusCode
2045 UA_FindServersRequest_encodeBinary(const UA_FindServersRequest *src, UA_ByteString *dst, size_t *offset) {
2046  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST], NULL, NULL, dst, offset);
2047 }
2048 static UA_INLINE UA_StatusCode
2049 UA_FindServersRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_FindServersRequest *dst) {
2050  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST]);
2051 }
2052 
2053 /* ReferenceDescription */
2054 static UA_INLINE UA_StatusCode
2055 UA_ReferenceDescription_encodeBinary(const UA_ReferenceDescription *src, UA_ByteString *dst, size_t *offset) {
2056  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION], NULL, NULL, dst, offset);
2057 }
2058 static UA_INLINE UA_StatusCode
2059 UA_ReferenceDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReferenceDescription *dst) {
2060  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION]);
2061 }
2062 
2063 /* SetPublishingModeResponse */
2064 static UA_INLINE UA_StatusCode
2065 UA_SetPublishingModeResponse_encodeBinary(const UA_SetPublishingModeResponse *src, UA_ByteString *dst, size_t *offset) {
2067 }
2068 static UA_INLINE UA_StatusCode
2069 UA_SetPublishingModeResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SetPublishingModeResponse *dst) {
2070  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODERESPONSE]);
2071 }
2072 
2073 /* ContentFilterResult */
2074 static UA_INLINE UA_StatusCode
2075 UA_ContentFilterResult_encodeBinary(const UA_ContentFilterResult *src, UA_ByteString *dst, size_t *offset) {
2076  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CONTENTFILTERRESULT], NULL, NULL, dst, offset);
2077 }
2078 static UA_INLINE UA_StatusCode
2079 UA_ContentFilterResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ContentFilterResult *dst) {
2080  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERRESULT]);
2081 }
2082 
2083 /* AddReferencesItem */
2084 static UA_INLINE UA_StatusCode
2085 UA_AddReferencesItem_encodeBinary(const UA_AddReferencesItem *src, UA_ByteString *dst, size_t *offset) {
2086  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDREFERENCESITEM], NULL, NULL, dst, offset);
2087 }
2088 static UA_INLINE UA_StatusCode
2089 UA_AddReferencesItem_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddReferencesItem *dst) {
2090  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESITEM]);
2091 }
2092 
2093 /* CreateSubscriptionResponse */
2094 static UA_INLINE UA_StatusCode
2095 UA_CreateSubscriptionResponse_encodeBinary(const UA_CreateSubscriptionResponse *src, UA_ByteString *dst, size_t *offset) {
2097 }
2098 static UA_INLINE UA_StatusCode
2099 UA_CreateSubscriptionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateSubscriptionResponse *dst) {
2100  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE]);
2101 }
2102 
2103 /* DeleteSubscriptionsResponse */
2104 static UA_INLINE UA_StatusCode
2105 UA_DeleteSubscriptionsResponse_encodeBinary(const UA_DeleteSubscriptionsResponse *src, UA_ByteString *dst, size_t *offset) {
2107 }
2108 static UA_INLINE UA_StatusCode
2109 UA_DeleteSubscriptionsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteSubscriptionsResponse *dst) {
2111 }
2112 
2113 /* RelativePath */
2114 static UA_INLINE UA_StatusCode
2115 UA_RelativePath_encodeBinary(const UA_RelativePath *src, UA_ByteString *dst, size_t *offset) {
2116  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_RELATIVEPATH], NULL, NULL, dst, offset);
2117 }
2118 static UA_INLINE UA_StatusCode
2119 UA_RelativePath_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RelativePath *dst) {
2120  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_RELATIVEPATH]);
2121 }
2122 
2123 /* DeleteReferencesResponse */
2124 static UA_INLINE UA_StatusCode
2125 UA_DeleteReferencesResponse_encodeBinary(const UA_DeleteReferencesResponse *src, UA_ByteString *dst, size_t *offset) {
2126  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE], NULL, NULL, dst, offset);
2127 }
2128 static UA_INLINE UA_StatusCode
2129 UA_DeleteReferencesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteReferencesResponse *dst) {
2130  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE]);
2131 }
2132 
2133 /* CreateMonitoredItemsResponse */
2134 static UA_INLINE UA_StatusCode
2135 UA_CreateMonitoredItemsResponse_encodeBinary(const UA_CreateMonitoredItemsResponse *src, UA_ByteString *dst, size_t *offset) {
2137 }
2138 static UA_INLINE UA_StatusCode
2139 UA_CreateMonitoredItemsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateMonitoredItemsResponse *dst) {
2141 }
2142 
2143 /* CallResponse */
2144 static UA_INLINE UA_StatusCode
2145 UA_CallResponse_encodeBinary(const UA_CallResponse *src, UA_ByteString *dst, size_t *offset) {
2146  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLRESPONSE], NULL, NULL, dst, offset);
2147 }
2148 static UA_INLINE UA_StatusCode
2149 UA_CallResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CallResponse *dst) {
2150  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLRESPONSE]);
2151 }
2152 
2153 /* DeleteNodesResponse */
2154 static UA_INLINE UA_StatusCode
2155 UA_DeleteNodesResponse_encodeBinary(const UA_DeleteNodesResponse *src, UA_ByteString *dst, size_t *offset) {
2156  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETENODESRESPONSE], NULL, NULL, dst, offset);
2157 }
2158 static UA_INLINE UA_StatusCode
2159 UA_DeleteNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteNodesResponse *dst) {
2160  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETENODESRESPONSE]);
2161 }
2162 
2163 /* RepublishResponse */
2164 static UA_INLINE UA_StatusCode
2165 UA_RepublishResponse_encodeBinary(const UA_RepublishResponse *src, UA_ByteString *dst, size_t *offset) {
2166  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE], NULL, NULL, dst, offset);
2167 }
2168 static UA_INLINE UA_StatusCode
2169 UA_RepublishResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RepublishResponse *dst) {
2170  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE]);
2171 }
2172 
2173 /* MonitoredItemCreateRequest */
2174 static UA_INLINE UA_StatusCode
2175 UA_MonitoredItemCreateRequest_encodeBinary(const UA_MonitoredItemCreateRequest *src, UA_ByteString *dst, size_t *offset) {
2177 }
2178 static UA_INLINE UA_StatusCode
2179 UA_MonitoredItemCreateRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemCreateRequest *dst) {
2180  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATEREQUEST]);
2181 }
2182 
2183 /* DeleteReferencesRequest */
2184 static UA_INLINE UA_StatusCode
2185 UA_DeleteReferencesRequest_encodeBinary(const UA_DeleteReferencesRequest *src, UA_ByteString *dst, size_t *offset) {
2186  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST], NULL, NULL, dst, offset);
2187 }
2188 static UA_INLINE UA_StatusCode
2189 UA_DeleteReferencesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteReferencesRequest *dst) {
2190  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST]);
2191 }
2192 
2193 /* ModifyMonitoredItemsResponse */
2194 static UA_INLINE UA_StatusCode
2195 UA_ModifyMonitoredItemsResponse_encodeBinary(const UA_ModifyMonitoredItemsResponse *src, UA_ByteString *dst, size_t *offset) {
2197 }
2198 static UA_INLINE UA_StatusCode
2199 UA_ModifyMonitoredItemsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ModifyMonitoredItemsResponse *dst) {
2201 }
2202 
2203 /* ReadResponse */
2204 static UA_INLINE UA_StatusCode
2205 UA_ReadResponse_encodeBinary(const UA_ReadResponse *src, UA_ByteString *dst, size_t *offset) {
2206  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_READRESPONSE], NULL, NULL, dst, offset);
2207 }
2208 static UA_INLINE UA_StatusCode
2209 UA_ReadResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReadResponse *dst) {
2210  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_READRESPONSE]);
2211 }
2212 
2213 /* AddReferencesRequest */
2214 static UA_INLINE UA_StatusCode
2215 UA_AddReferencesRequest_encodeBinary(const UA_AddReferencesRequest *src, UA_ByteString *dst, size_t *offset) {
2216  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST], NULL, NULL, dst, offset);
2217 }
2218 static UA_INLINE UA_StatusCode
2219 UA_AddReferencesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddReferencesRequest *dst) {
2220  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST]);
2221 }
2222 
2223 /* ReadRequest */
2224 static UA_INLINE UA_StatusCode
2225 UA_ReadRequest_encodeBinary(const UA_ReadRequest *src, UA_ByteString *dst, size_t *offset) {
2226  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_READREQUEST], NULL, NULL, dst, offset);
2227 }
2228 static UA_INLINE UA_StatusCode
2229 UA_ReadRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReadRequest *dst) {
2230  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_READREQUEST]);
2231 }
2232 
2233 /* AddNodesItem */
2234 static UA_INLINE UA_StatusCode
2235 UA_AddNodesItem_encodeBinary(const UA_AddNodesItem *src, UA_ByteString *dst, size_t *offset) {
2236  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESITEM], NULL, NULL, dst, offset);
2237 }
2238 static UA_INLINE UA_StatusCode
2239 UA_AddNodesItem_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddNodesItem *dst) {
2240  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESITEM]);
2241 }
2242 
2243 /* ServerStatusDataType */
2244 static UA_INLINE UA_StatusCode
2245 UA_ServerStatusDataType_encodeBinary(const UA_ServerStatusDataType *src, UA_ByteString *dst, size_t *offset) {
2246  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE], NULL, NULL, dst, offset);
2247 }
2248 static UA_INLINE UA_StatusCode
2249 UA_ServerStatusDataType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ServerStatusDataType *dst) {
2250  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE]);
2251 }
2252 
2253 /* AddReferencesResponse */
2254 static UA_INLINE UA_StatusCode
2255 UA_AddReferencesResponse_encodeBinary(const UA_AddReferencesResponse *src, UA_ByteString *dst, size_t *offset) {
2256  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE], NULL, NULL, dst, offset);
2257 }
2258 static UA_INLINE UA_StatusCode
2259 UA_AddReferencesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddReferencesResponse *dst) {
2260  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE]);
2261 }
2262 
2263 /* TranslateBrowsePathsToNodeIdsResponse */
2264 static UA_INLINE UA_StatusCode
2265 UA_TranslateBrowsePathsToNodeIdsResponse_encodeBinary(const UA_TranslateBrowsePathsToNodeIdsResponse *src, UA_ByteString *dst, size_t *offset) {
2267 }
2268 static UA_INLINE UA_StatusCode
2269 UA_TranslateBrowsePathsToNodeIdsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TranslateBrowsePathsToNodeIdsResponse *dst) {
2271 }
2272 
2273 /* DataChangeFilter */
2274 static UA_INLINE UA_StatusCode
2275 UA_DataChangeFilter_encodeBinary(const UA_DataChangeFilter *src, UA_ByteString *dst, size_t *offset) {
2276  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATACHANGEFILTER], NULL, NULL, dst, offset);
2277 }
2278 static UA_INLINE UA_StatusCode
2279 UA_DataChangeFilter_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataChangeFilter *dst) {
2280  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATACHANGEFILTER]);
2281 }
2282 
2283 /* ContentFilterElement */
2284 static UA_INLINE UA_StatusCode
2285 UA_ContentFilterElement_encodeBinary(const UA_ContentFilterElement *src, UA_ByteString *dst, size_t *offset) {
2286  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENT], NULL, NULL, dst, offset);
2287 }
2288 static UA_INLINE UA_StatusCode
2289 UA_ContentFilterElement_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ContentFilterElement *dst) {
2290  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENT]);
2291 }
2292 
2293 /* CloseSessionResponse */
2294 static UA_INLINE UA_StatusCode
2295 UA_CloseSessionResponse_encodeBinary(const UA_CloseSessionResponse *src, UA_ByteString *dst, size_t *offset) {
2296  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE], NULL, NULL, dst, offset);
2297 }
2298 static UA_INLINE UA_StatusCode
2299 UA_CloseSessionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CloseSessionResponse *dst) {
2300  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE]);
2301 }
2302 
2303 /* ApplicationDescription */
2304 static UA_INLINE UA_StatusCode
2305 UA_ApplicationDescription_encodeBinary(const UA_ApplicationDescription *src, UA_ByteString *dst, size_t *offset) {
2306  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_APPLICATIONDESCRIPTION], NULL, NULL, dst, offset);
2307 }
2308 static UA_INLINE UA_StatusCode
2309 UA_ApplicationDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ApplicationDescription *dst) {
2310  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_APPLICATIONDESCRIPTION]);
2311 }
2312 
2313 /* ServiceFault */
2314 static UA_INLINE UA_StatusCode
2315 UA_ServiceFault_encodeBinary(const UA_ServiceFault *src, UA_ByteString *dst, size_t *offset) {
2316  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVICEFAULT], NULL, NULL, dst, offset);
2317 }
2318 static UA_INLINE UA_StatusCode
2319 UA_ServiceFault_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ServiceFault *dst) {
2320  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVICEFAULT]);
2321 }
2322 
2323 /* FindServersResponse */
2324 static UA_INLINE UA_StatusCode
2325 UA_FindServersResponse_encodeBinary(const UA_FindServersResponse *src, UA_ByteString *dst, size_t *offset) {
2326  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE], NULL, NULL, dst, offset);
2327 }
2328 static UA_INLINE UA_StatusCode
2329 UA_FindServersResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_FindServersResponse *dst) {
2330  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE]);
2331 }
2332 
2333 /* CreateMonitoredItemsRequest */
2334 static UA_INLINE UA_StatusCode
2335 UA_CreateMonitoredItemsRequest_encodeBinary(const UA_CreateMonitoredItemsRequest *src, UA_ByteString *dst, size_t *offset) {
2337 }
2338 static UA_INLINE UA_StatusCode
2339 UA_CreateMonitoredItemsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateMonitoredItemsRequest *dst) {
2341 }
2342 
2343 /* ContentFilter */
2344 static UA_INLINE UA_StatusCode
2345 UA_ContentFilter_encodeBinary(const UA_ContentFilter *src, UA_ByteString *dst, size_t *offset) {
2346  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CONTENTFILTER], NULL, NULL, dst, offset);
2347 }
2348 static UA_INLINE UA_StatusCode
2349 UA_ContentFilter_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ContentFilter *dst) {
2350  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTER]);
2351 }
2352 
2353 /* QueryFirstResponse */
2354 static UA_INLINE UA_StatusCode
2355 UA_QueryFirstResponse_encodeBinary(const UA_QueryFirstResponse *src, UA_ByteString *dst, size_t *offset) {
2356  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE], NULL, NULL, dst, offset);
2357 }
2358 static UA_INLINE UA_StatusCode
2359 UA_QueryFirstResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryFirstResponse *dst) {
2360  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE]);
2361 }
2362 
2363 /* AddNodesRequest */
2364 static UA_INLINE UA_StatusCode
2365 UA_AddNodesRequest_encodeBinary(const UA_AddNodesRequest *src, UA_ByteString *dst, size_t *offset) {
2366  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESREQUEST], NULL, NULL, dst, offset);
2367 }
2368 static UA_INLINE UA_StatusCode
2369 UA_AddNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddNodesRequest *dst) {
2370  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESREQUEST]);
2371 }
2372 
2373 /* BrowseRequest */
2374 static UA_INLINE UA_StatusCode
2375 UA_BrowseRequest_encodeBinary(const UA_BrowseRequest *src, UA_ByteString *dst, size_t *offset) {
2376  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEREQUEST], NULL, NULL, dst, offset);
2377 }
2378 static UA_INLINE UA_StatusCode
2379 UA_BrowseRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseRequest *dst) {
2380  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEREQUEST]);
2381 }
2382 
2383 /* BrowsePath */
2384 static UA_INLINE UA_StatusCode
2385 UA_BrowsePath_encodeBinary(const UA_BrowsePath *src, UA_ByteString *dst, size_t *offset) {
2386  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEPATH], NULL, NULL, dst, offset);
2387 }
2388 static UA_INLINE UA_StatusCode
2389 UA_BrowsePath_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowsePath *dst) {
2390  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEPATH]);
2391 }
2392 
2393 /* BrowseResult */
2394 static UA_INLINE UA_StatusCode
2395 UA_BrowseResult_encodeBinary(const UA_BrowseResult *src, UA_ByteString *dst, size_t *offset) {
2396  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSERESULT], NULL, NULL, dst, offset);
2397 }
2398 static UA_INLINE UA_StatusCode
2399 UA_BrowseResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseResult *dst) {
2400  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSERESULT]);
2401 }
2402 
2403 /* CreateSessionRequest */
2404 static UA_INLINE UA_StatusCode
2405 UA_CreateSessionRequest_encodeBinary(const UA_CreateSessionRequest *src, UA_ByteString *dst, size_t *offset) {
2406  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST], NULL, NULL, dst, offset);
2407 }
2408 static UA_INLINE UA_StatusCode
2409 UA_CreateSessionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateSessionRequest *dst) {
2410  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST]);
2411 }
2412 
2413 /* QueryDataDescription */
2414 static UA_INLINE UA_StatusCode
2415 UA_QueryDataDescription_encodeBinary(const UA_QueryDataDescription *src, UA_ByteString *dst, size_t *offset) {
2416  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYDATADESCRIPTION], NULL, NULL, dst, offset);
2417 }
2418 static UA_INLINE UA_StatusCode
2419 UA_QueryDataDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryDataDescription *dst) {
2420  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYDATADESCRIPTION]);
2421 }
2422 
2423 /* EndpointDescription */
2424 static UA_INLINE UA_StatusCode
2425 UA_EndpointDescription_encodeBinary(const UA_EndpointDescription *src, UA_ByteString *dst, size_t *offset) {
2426  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION], NULL, NULL, dst, offset);
2427 }
2428 static UA_INLINE UA_StatusCode
2429 UA_EndpointDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_EndpointDescription *dst) {
2430  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
2431 }
2432 
2433 /* GetEndpointsResponse */
2434 static UA_INLINE UA_StatusCode
2435 UA_GetEndpointsResponse_encodeBinary(const UA_GetEndpointsResponse *src, UA_ByteString *dst, size_t *offset) {
2436  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE], NULL, NULL, dst, offset);
2437 }
2438 static UA_INLINE UA_StatusCode
2439 UA_GetEndpointsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_GetEndpointsResponse *dst) {
2440  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE]);
2441 }
2442 
2443 /* NodeTypeDescription */
2444 static UA_INLINE UA_StatusCode
2445 UA_NodeTypeDescription_encodeBinary(const UA_NodeTypeDescription *src, UA_ByteString *dst, size_t *offset) {
2446  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODETYPEDESCRIPTION], NULL, NULL, dst, offset);
2447 }
2448 static UA_INLINE UA_StatusCode
2449 UA_NodeTypeDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeTypeDescription *dst) {
2450  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODETYPEDESCRIPTION]);
2451 }
2452 
2453 /* BrowseNextResponse */
2454 static UA_INLINE UA_StatusCode
2455 UA_BrowseNextResponse_encodeBinary(const UA_BrowseNextResponse *src, UA_ByteString *dst, size_t *offset) {
2456  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE], NULL, NULL, dst, offset);
2457 }
2458 static UA_INLINE UA_StatusCode
2459 UA_BrowseNextResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseNextResponse *dst) {
2460  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE]);
2461 }
2462 
2463 /* TranslateBrowsePathsToNodeIdsRequest */
2464 static UA_INLINE UA_StatusCode
2465 UA_TranslateBrowsePathsToNodeIdsRequest_encodeBinary(const UA_TranslateBrowsePathsToNodeIdsRequest *src, UA_ByteString *dst, size_t *offset) {
2467 }
2468 static UA_INLINE UA_StatusCode
2469 UA_TranslateBrowsePathsToNodeIdsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TranslateBrowsePathsToNodeIdsRequest *dst) {
2471 }
2472 
2473 /* BrowseResponse */
2474 static UA_INLINE UA_StatusCode
2475 UA_BrowseResponse_encodeBinary(const UA_BrowseResponse *src, UA_ByteString *dst, size_t *offset) {
2476  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSERESPONSE], NULL, NULL, dst, offset);
2477 }
2478 static UA_INLINE UA_StatusCode
2479 UA_BrowseResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseResponse *dst) {
2480  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSERESPONSE]);
2481 }
2482 
2483 /* CreateSessionResponse */
2484 static UA_INLINE UA_StatusCode
2485 UA_CreateSessionResponse_encodeBinary(const UA_CreateSessionResponse *src, UA_ByteString *dst, size_t *offset) {
2486  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE], NULL, NULL, dst, offset);
2487 }
2488 static UA_INLINE UA_StatusCode
2489 UA_CreateSessionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateSessionResponse *dst) {
2490  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE]);
2491 }
2492 
2493 /* QueryFirstRequest */
2494 static UA_INLINE UA_StatusCode
2495 UA_QueryFirstRequest_encodeBinary(const UA_QueryFirstRequest *src, UA_ByteString *dst, size_t *offset) {
2496  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST], NULL, NULL, dst, offset);
2497 }
2498 static UA_INLINE UA_StatusCode
2499 UA_QueryFirstRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryFirstRequest *dst) {
2500  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST]);
2501 }
2502 
2503 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_transport_generated.h" ***********************************/
2504 
2505 /* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
2506  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:06 */
2507 
2508 
2509 #ifdef __cplusplus
2510 extern "C" {
2511 #endif
2512 
2513 
2518 #define UA_TRANSPORT_COUNT 12
2520 
2525 typedef struct {
2529 
2530 #define UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY 0
2531 
2536 typedef struct {
2537  size_t paddingSize;
2541 
2542 #define UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER 1
2543 
2548 typedef struct {
2556 
2557 #define UA_TRANSPORT_TCPHELLOMESSAGE 2
2558 
2563 typedef struct {
2567 
2568 #define UA_TRANSPORT_TCPERRORMESSAGE 3
2569 
2574 typedef enum {
2582 } UA_MessageType;
2583 UA_STATIC_ASSERT(sizeof(UA_MessageType) == sizeof(UA_Int32), enum_must_be_32bit);
2584 
2585 #define UA_TRANSPORT_MESSAGETYPE 4
2586 
2591 typedef struct {
2596 
2597 #define UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER 5
2598 
2603 typedef struct {
2610 
2611 #define UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE 6
2612 
2617 typedef struct {
2621 
2622 #define UA_TRANSPORT_SEQUENCEHEADER 7
2623 
2628 typedef struct {
2632 
2633 #define UA_TRANSPORT_TCPMESSAGEHEADER 8
2634 
2639 typedef enum {
2640  UA_CHUNKTYPE_FINAL = 0x46000000,
2642  UA_CHUNKTYPE_ABORT = 0x41000000,
2644 } UA_ChunkType;
2645 UA_STATIC_ASSERT(sizeof(UA_ChunkType) == sizeof(UA_Int32), enum_must_be_32bit);
2646 
2647 #define UA_TRANSPORT_CHUNKTYPE 9
2648 
2653 typedef struct {
2656 
2657 #define UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER 10
2658 
2663 typedef struct {
2667 
2668 #define UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER 11
2669 
2670 #ifdef __cplusplus
2671 } // extern "C"
2672 #endif
2673 
2674 
2675 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_transport_generated_handling.h" ***********************************/
2676 
2677 /* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
2678  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:06 */
2679 
2680 
2681 #ifdef __cplusplus
2682 extern "C" {
2683 #endif
2684 
2685 
2686 #if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
2687 # pragma GCC diagnostic push
2688 # pragma GCC diagnostic ignored "-Wmissing-field-initializers"
2689 # pragma GCC diagnostic ignored "-Wmissing-braces"
2690 #endif
2691 
2692 
2693 /* SecureConversationMessageAbortBody */
2694 static UA_INLINE void
2695 UA_SecureConversationMessageAbortBody_init(UA_SecureConversationMessageAbortBody *p) {
2696  memset(p, 0, sizeof(UA_SecureConversationMessageAbortBody));
2697 }
2698 
2700 UA_SecureConversationMessageAbortBody_new(void) {
2702 }
2703 
2704 static UA_INLINE UA_StatusCode
2705 UA_SecureConversationMessageAbortBody_copy(const UA_SecureConversationMessageAbortBody *src, UA_SecureConversationMessageAbortBody *dst) {
2706  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY]);
2707 }
2708 
2709 static UA_INLINE void
2710 UA_SecureConversationMessageAbortBody_deleteMembers(UA_SecureConversationMessageAbortBody *p) {
2712 }
2713 
2714 static UA_INLINE void
2715 UA_SecureConversationMessageAbortBody_delete(UA_SecureConversationMessageAbortBody *p) {
2717 }
2718 
2719 /* SecureConversationMessageFooter */
2720 static UA_INLINE void
2721 UA_SecureConversationMessageFooter_init(UA_SecureConversationMessageFooter *p) {
2722  memset(p, 0, sizeof(UA_SecureConversationMessageFooter));
2723 }
2724 
2726 UA_SecureConversationMessageFooter_new(void) {
2728 }
2729 
2730 static UA_INLINE UA_StatusCode
2731 UA_SecureConversationMessageFooter_copy(const UA_SecureConversationMessageFooter *src, UA_SecureConversationMessageFooter *dst) {
2732  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER]);
2733 }
2734 
2735 static UA_INLINE void
2736 UA_SecureConversationMessageFooter_deleteMembers(UA_SecureConversationMessageFooter *p) {
2738 }
2739 
2740 static UA_INLINE void
2741 UA_SecureConversationMessageFooter_delete(UA_SecureConversationMessageFooter *p) {
2743 }
2744 
2745 /* TcpHelloMessage */
2746 static UA_INLINE void
2747 UA_TcpHelloMessage_init(UA_TcpHelloMessage *p) {
2748  memset(p, 0, sizeof(UA_TcpHelloMessage));
2749 }
2750 
2752 UA_TcpHelloMessage_new(void) {
2753  return (UA_TcpHelloMessage*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]);
2754 }
2755 
2756 static UA_INLINE UA_StatusCode
2757 UA_TcpHelloMessage_copy(const UA_TcpHelloMessage *src, UA_TcpHelloMessage *dst) {
2758  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]);
2759 }
2760 
2761 static UA_INLINE void
2762 UA_TcpHelloMessage_deleteMembers(UA_TcpHelloMessage *p) {
2764 }
2765 
2766 static UA_INLINE void
2767 UA_TcpHelloMessage_delete(UA_TcpHelloMessage *p) {
2768  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]);
2769 }
2770 
2771 /* TcpErrorMessage */
2772 static UA_INLINE void
2773 UA_TcpErrorMessage_init(UA_TcpErrorMessage *p) {
2774  memset(p, 0, sizeof(UA_TcpErrorMessage));
2775 }
2776 
2778 UA_TcpErrorMessage_new(void) {
2779  return (UA_TcpErrorMessage*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]);
2780 }
2781 
2782 static UA_INLINE UA_StatusCode
2783 UA_TcpErrorMessage_copy(const UA_TcpErrorMessage *src, UA_TcpErrorMessage *dst) {
2784  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]);
2785 }
2786 
2787 static UA_INLINE void
2788 UA_TcpErrorMessage_deleteMembers(UA_TcpErrorMessage *p) {
2790 }
2791 
2792 static UA_INLINE void
2793 UA_TcpErrorMessage_delete(UA_TcpErrorMessage *p) {
2794  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]);
2795 }
2796 
2797 /* MessageType */
2798 static UA_INLINE void
2799 UA_MessageType_init(UA_MessageType *p) {
2800  memset(p, 0, sizeof(UA_MessageType));
2801 }
2802 
2803 static UA_INLINE UA_MessageType *
2804 UA_MessageType_new(void) {
2805  return (UA_MessageType*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE]);
2806 }
2807 
2808 static UA_INLINE UA_StatusCode
2809 UA_MessageType_copy(const UA_MessageType *src, UA_MessageType *dst) {
2810  *dst = *src;
2811  return UA_STATUSCODE_GOOD;
2812 }
2813 
2814 static UA_INLINE void
2815 UA_MessageType_deleteMembers(UA_MessageType *p) { }
2816 
2817 static UA_INLINE void
2818 UA_MessageType_delete(UA_MessageType *p) {
2819  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE]);
2820 }
2821 
2822 /* AsymmetricAlgorithmSecurityHeader */
2823 static UA_INLINE void
2824 UA_AsymmetricAlgorithmSecurityHeader_init(UA_AsymmetricAlgorithmSecurityHeader *p) {
2825  memset(p, 0, sizeof(UA_AsymmetricAlgorithmSecurityHeader));
2826 }
2827 
2829 UA_AsymmetricAlgorithmSecurityHeader_new(void) {
2831 }
2832 
2833 static UA_INLINE UA_StatusCode
2834 UA_AsymmetricAlgorithmSecurityHeader_copy(const UA_AsymmetricAlgorithmSecurityHeader *src, UA_AsymmetricAlgorithmSecurityHeader *dst) {
2835  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER]);
2836 }
2837 
2838 static UA_INLINE void
2839 UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(UA_AsymmetricAlgorithmSecurityHeader *p) {
2841 }
2842 
2843 static UA_INLINE void
2844 UA_AsymmetricAlgorithmSecurityHeader_delete(UA_AsymmetricAlgorithmSecurityHeader *p) {
2846 }
2847 
2848 /* TcpAcknowledgeMessage */
2849 static UA_INLINE void
2850 UA_TcpAcknowledgeMessage_init(UA_TcpAcknowledgeMessage *p) {
2851  memset(p, 0, sizeof(UA_TcpAcknowledgeMessage));
2852 }
2853 
2855 UA_TcpAcknowledgeMessage_new(void) {
2857 }
2858 
2859 static UA_INLINE UA_StatusCode
2860 UA_TcpAcknowledgeMessage_copy(const UA_TcpAcknowledgeMessage *src, UA_TcpAcknowledgeMessage *dst) {
2861  *dst = *src;
2862  return UA_STATUSCODE_GOOD;
2863 }
2864 
2865 static UA_INLINE void
2866 UA_TcpAcknowledgeMessage_deleteMembers(UA_TcpAcknowledgeMessage *p) { }
2867 
2868 static UA_INLINE void
2869 UA_TcpAcknowledgeMessage_delete(UA_TcpAcknowledgeMessage *p) {
2870  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE]);
2871 }
2872 
2873 /* SequenceHeader */
2874 static UA_INLINE void
2875 UA_SequenceHeader_init(UA_SequenceHeader *p) {
2876  memset(p, 0, sizeof(UA_SequenceHeader));
2877 }
2878 
2880 UA_SequenceHeader_new(void) {
2881  return (UA_SequenceHeader*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER]);
2882 }
2883 
2884 static UA_INLINE UA_StatusCode
2885 UA_SequenceHeader_copy(const UA_SequenceHeader *src, UA_SequenceHeader *dst) {
2886  *dst = *src;
2887  return UA_STATUSCODE_GOOD;
2888 }
2889 
2890 static UA_INLINE void
2891 UA_SequenceHeader_deleteMembers(UA_SequenceHeader *p) { }
2892 
2893 static UA_INLINE void
2894 UA_SequenceHeader_delete(UA_SequenceHeader *p) {
2895  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER]);
2896 }
2897 
2898 /* TcpMessageHeader */
2899 static UA_INLINE void
2900 UA_TcpMessageHeader_init(UA_TcpMessageHeader *p) {
2901  memset(p, 0, sizeof(UA_TcpMessageHeader));
2902 }
2903 
2905 UA_TcpMessageHeader_new(void) {
2906  return (UA_TcpMessageHeader*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER]);
2907 }
2908 
2909 static UA_INLINE UA_StatusCode
2910 UA_TcpMessageHeader_copy(const UA_TcpMessageHeader *src, UA_TcpMessageHeader *dst) {
2911  *dst = *src;
2912  return UA_STATUSCODE_GOOD;
2913 }
2914 
2915 static UA_INLINE void
2916 UA_TcpMessageHeader_deleteMembers(UA_TcpMessageHeader *p) { }
2917 
2918 static UA_INLINE void
2919 UA_TcpMessageHeader_delete(UA_TcpMessageHeader *p) {
2920  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER]);
2921 }
2922 
2923 /* ChunkType */
2924 static UA_INLINE void
2925 UA_ChunkType_init(UA_ChunkType *p) {
2926  memset(p, 0, sizeof(UA_ChunkType));
2927 }
2928 
2929 static UA_INLINE UA_ChunkType *
2930 UA_ChunkType_new(void) {
2931  return (UA_ChunkType*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE]);
2932 }
2933 
2934 static UA_INLINE UA_StatusCode
2935 UA_ChunkType_copy(const UA_ChunkType *src, UA_ChunkType *dst) {
2936  *dst = *src;
2937  return UA_STATUSCODE_GOOD;
2938 }
2939 
2940 static UA_INLINE void
2941 UA_ChunkType_deleteMembers(UA_ChunkType *p) { }
2942 
2943 static UA_INLINE void
2944 UA_ChunkType_delete(UA_ChunkType *p) {
2945  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE]);
2946 }
2947 
2948 /* SymmetricAlgorithmSecurityHeader */
2949 static UA_INLINE void
2950 UA_SymmetricAlgorithmSecurityHeader_init(UA_SymmetricAlgorithmSecurityHeader *p) {
2951  memset(p, 0, sizeof(UA_SymmetricAlgorithmSecurityHeader));
2952 }
2953 
2955 UA_SymmetricAlgorithmSecurityHeader_new(void) {
2957 }
2958 
2959 static UA_INLINE UA_StatusCode
2960 UA_SymmetricAlgorithmSecurityHeader_copy(const UA_SymmetricAlgorithmSecurityHeader *src, UA_SymmetricAlgorithmSecurityHeader *dst) {
2961  *dst = *src;
2962  return UA_STATUSCODE_GOOD;
2963 }
2964 
2965 static UA_INLINE void
2966 UA_SymmetricAlgorithmSecurityHeader_deleteMembers(UA_SymmetricAlgorithmSecurityHeader *p) { }
2967 
2968 static UA_INLINE void
2969 UA_SymmetricAlgorithmSecurityHeader_delete(UA_SymmetricAlgorithmSecurityHeader *p) {
2971 }
2972 
2973 /* SecureConversationMessageHeader */
2974 static UA_INLINE void
2975 UA_SecureConversationMessageHeader_init(UA_SecureConversationMessageHeader *p) {
2976  memset(p, 0, sizeof(UA_SecureConversationMessageHeader));
2977 }
2978 
2980 UA_SecureConversationMessageHeader_new(void) {
2982 }
2983 
2984 static UA_INLINE UA_StatusCode
2985 UA_SecureConversationMessageHeader_copy(const UA_SecureConversationMessageHeader *src, UA_SecureConversationMessageHeader *dst) {
2986  *dst = *src;
2987  return UA_STATUSCODE_GOOD;
2988 }
2989 
2990 static UA_INLINE void
2991 UA_SecureConversationMessageHeader_deleteMembers(UA_SecureConversationMessageHeader *p) { }
2992 
2993 static UA_INLINE void
2994 UA_SecureConversationMessageHeader_delete(UA_SecureConversationMessageHeader *p) {
2996 }
2997 
2998 #if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
2999 # pragma GCC diagnostic pop
3000 #endif
3001 
3002 #ifdef __cplusplus
3003 } // extern "C"
3004 #endif
3005 
3006 
3007 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_transport_generated_encoding_binary.h" ***********************************/
3008 
3009 /* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
3010  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:06 */
3011 
3012 
3013 /* SecureConversationMessageAbortBody */
3014 static UA_INLINE UA_StatusCode
3015 UA_SecureConversationMessageAbortBody_encodeBinary(const UA_SecureConversationMessageAbortBody *src, UA_ByteString *dst, size_t *offset) {
3016  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY], NULL, NULL, dst, offset);
3017 }
3018 static UA_INLINE UA_StatusCode
3019 UA_SecureConversationMessageAbortBody_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SecureConversationMessageAbortBody *dst) {
3020  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY]);
3021 }
3022 
3023 /* SecureConversationMessageFooter */
3024 static UA_INLINE UA_StatusCode
3025 UA_SecureConversationMessageFooter_encodeBinary(const UA_SecureConversationMessageFooter *src, UA_ByteString *dst, size_t *offset) {
3026  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER], NULL, NULL, dst, offset);
3027 }
3028 static UA_INLINE UA_StatusCode
3029 UA_SecureConversationMessageFooter_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SecureConversationMessageFooter *dst) {
3030  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER]);
3031 }
3032 
3033 /* TcpHelloMessage */
3034 static UA_INLINE UA_StatusCode
3035 UA_TcpHelloMessage_encodeBinary(const UA_TcpHelloMessage *src, UA_ByteString *dst, size_t *offset) {
3036  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE], NULL, NULL, dst, offset);
3037 }
3038 static UA_INLINE UA_StatusCode
3039 UA_TcpHelloMessage_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TcpHelloMessage *dst) {
3040  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]);
3041 }
3042 
3043 /* TcpErrorMessage */
3044 static UA_INLINE UA_StatusCode
3045 UA_TcpErrorMessage_encodeBinary(const UA_TcpErrorMessage *src, UA_ByteString *dst, size_t *offset) {
3046  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE], NULL, NULL, dst, offset);
3047 }
3048 static UA_INLINE UA_StatusCode
3049 UA_TcpErrorMessage_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TcpErrorMessage *dst) {
3050  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]);
3051 }
3052 
3053 /* MessageType */
3054 static UA_INLINE UA_StatusCode
3055 UA_MessageType_encodeBinary(const UA_MessageType *src, UA_ByteString *dst, size_t *offset) {
3056  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE], NULL, NULL, dst, offset);
3057 }
3058 static UA_INLINE UA_StatusCode
3059 UA_MessageType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MessageType *dst) {
3060  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE]);
3061 }
3062 
3063 /* AsymmetricAlgorithmSecurityHeader */
3064 static UA_INLINE UA_StatusCode
3065 UA_AsymmetricAlgorithmSecurityHeader_encodeBinary(const UA_AsymmetricAlgorithmSecurityHeader *src, UA_ByteString *dst, size_t *offset) {
3066  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER], NULL, NULL, dst, offset);
3067 }
3068 static UA_INLINE UA_StatusCode
3069 UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AsymmetricAlgorithmSecurityHeader *dst) {
3070  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER]);
3071 }
3072 
3073 /* TcpAcknowledgeMessage */
3074 static UA_INLINE UA_StatusCode
3075 UA_TcpAcknowledgeMessage_encodeBinary(const UA_TcpAcknowledgeMessage *src, UA_ByteString *dst, size_t *offset) {
3076  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE], NULL, NULL, dst, offset);
3077 }
3078 static UA_INLINE UA_StatusCode
3079 UA_TcpAcknowledgeMessage_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TcpAcknowledgeMessage *dst) {
3080  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE]);
3081 }
3082 
3083 /* SequenceHeader */
3084 static UA_INLINE UA_StatusCode
3085 UA_SequenceHeader_encodeBinary(const UA_SequenceHeader *src, UA_ByteString *dst, size_t *offset) {
3086  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER], NULL, NULL, dst, offset);
3087 }
3088 static UA_INLINE UA_StatusCode
3089 UA_SequenceHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SequenceHeader *dst) {
3090  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER]);
3091 }
3092 
3093 /* TcpMessageHeader */
3094 static UA_INLINE UA_StatusCode
3095 UA_TcpMessageHeader_encodeBinary(const UA_TcpMessageHeader *src, UA_ByteString *dst, size_t *offset) {
3096  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER], NULL, NULL, dst, offset);
3097 }
3098 static UA_INLINE UA_StatusCode
3099 UA_TcpMessageHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TcpMessageHeader *dst) {
3100  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER]);
3101 }
3102 
3103 /* ChunkType */
3104 static UA_INLINE UA_StatusCode
3105 UA_ChunkType_encodeBinary(const UA_ChunkType *src, UA_ByteString *dst, size_t *offset) {
3106  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE], NULL, NULL, dst, offset);
3107 }
3108 static UA_INLINE UA_StatusCode
3109 UA_ChunkType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ChunkType *dst) {
3110  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE]);
3111 }
3112 
3113 /* SymmetricAlgorithmSecurityHeader */
3114 static UA_INLINE UA_StatusCode
3115 UA_SymmetricAlgorithmSecurityHeader_encodeBinary(const UA_SymmetricAlgorithmSecurityHeader *src, UA_ByteString *dst, size_t *offset) {
3116  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER], NULL, NULL, dst, offset);
3117 }
3118 static UA_INLINE UA_StatusCode
3119 UA_SymmetricAlgorithmSecurityHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SymmetricAlgorithmSecurityHeader *dst) {
3120  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER]);
3121 }
3122 
3123 /* SecureConversationMessageHeader */
3124 static UA_INLINE UA_StatusCode
3125 UA_SecureConversationMessageHeader_encodeBinary(const UA_SecureConversationMessageHeader *src, UA_ByteString *dst, size_t *offset) {
3126  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER], NULL, NULL, dst, offset);
3127 }
3128 static UA_INLINE UA_StatusCode
3129 UA_SecureConversationMessageHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SecureConversationMessageHeader *dst) {
3130  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER]);
3131 }
3132 
3133 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_connection_internal.h" ***********************************/
3134 
3135 /* This Source Code Form is subject to the terms of the Mozilla Public
3136 * License, v. 2.0. If a copy of the MPL was not distributed with this
3137 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3138 
3139 
3140 
3141 /* The network layer may receive chopped up messages since TCP is a streaming
3142  * protocol. Furthermore, the networklayer may operate on ringbuffers or
3143  * statically assigned memory.
3144  *
3145  * If an entire message is received, it is forwarded directly. But the memory
3146  * needs to be freed with the networklayer-specific mechanism. If a half message
3147  * is received, we copy it into a local buffer. Then, the stack-specific free
3148  * needs to be used.
3149  *
3150  * @param connection The connection
3151  * @param message The received message. The content may be overwritten when a
3152  * previsouly received buffer is completed.
3153  * @param realloced The Boolean value is set to true if the outgoing message has
3154  * been reallocated from the network layer.
3155  * @return Returns UA_STATUSCODE_GOOD or an error code. When an error occurs, the ingoing message
3156  * and the current buffer in the connection are freed. */
3159  UA_Boolean *realloced);
3160 
3161 /* Try to receive at least one complete chunk on the connection. This blocks the
3162  * current thread up to the given timeout.
3163  *
3164  * @param connection The connection
3165  * @param chunk The received chunk. The memory is allocated either by the
3166  * networklayer or internally.
3167  * @param realloced The Boolean value is set to true if the chunk has been
3168  * reallocated from the network layer.
3169  * @param timeout The timeout (in milliseconds) the method will block at most.
3170  * @return Returns UA_STATUSCODE_GOOD or an error code. When an error occurs,
3171  * the chunk buffer is returned empty. Upon a timeout,
3172  * UA_STATUSCODE_GOODNONCRITICALTIMEOUT is returned.
3173  */
3176  UA_Boolean *realloced, UA_UInt32 timeout);
3177 
3180 
3181 /* Split the given endpoint url into hostname and port. Some of the chunks are
3182  * returned as pointer.
3183  * @param endpointUrl The endpoint URL to split up
3184  * @param hostname the target array for hostname. Has to be at least 256 size.
3185  * @param port if url contains port, it will point to the beginning of port.
3186  * NULL otherwise. It may also include the path part, thus stop at
3187  * position of path pointer, if it is not NULL.
3188  * @param path points to the first occurance of '/' after the port or NULL if no
3189  * path in url
3190  * @return UA_STATUSCODE_BADOUTOFRANGE if url too long,
3191  * UA_STATUSCODE_BADATTRIBUTEIDINVALID if url not starting with
3192  * 'opc.tcp://', UA_STATUSCODE_GOOD on success */
3194 UA_EndpointUrl_split_ptr(const char *endpointUrl, char *hostname,
3195  const char ** port, const char ** path);
3196 
3197 
3198 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_securechannel.h" ***********************************/
3199 
3200 /* This Source Code Form is subject to the terms of the Mozilla Public
3201 * License, v. 2.0. If a copy of the MPL was not distributed with this
3202 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3203 
3204 
3205 
3206 struct UA_Session;
3207 typedef struct UA_Session UA_Session;
3208 
3210  LIST_ENTRY(SessionEntry) pointers;
3211  UA_Session *session; // Just a pointer. The session is held in the session manager or the client
3212 };
3213 
3214 /* For chunked requests */
3215 struct ChunkEntry {
3216  LIST_ENTRY(ChunkEntry) pointers;
3217  UA_UInt32 requestId;
3218  UA_ByteString bytes;
3219 };
3220 
3221 /* For chunked responses */
3222 typedef struct {
3228  UA_Boolean final;
3230 } UA_ChunkInfo;
3231 
3234  UA_ChannelSecurityToken securityToken; // the channelId is contained in the securityToken
3235  UA_ChannelSecurityToken nextSecurityToken; // the channelId is contained in the securityToken
3243  LIST_HEAD(session_pointerlist, SessionEntry) sessions;
3244  LIST_HEAD(chunk_pointerlist, ChunkEntry) chunks;
3245 };
3246 
3249 
3251 
3255 
3257  const void *content, const UA_DataType *contentType);
3258 
3260 
3264 typedef void
3265 (UA_ProcessMessageCallback)(void *application, UA_SecureChannel *channel,
3266  UA_MessageType messageType, UA_UInt32 requestId,
3267  const UA_ByteString *message);
3268 
3271  UA_ProcessMessageCallback callback, void *application);
3272 
3276 #define UA_LOG_TRACE_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3277  UA_LOG_TRACE(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3278  ((CHANNEL)->connection ? CHANNEL->connection->sockfd : 0), \
3279  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3280 
3281 #define UA_LOG_DEBUG_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3282  UA_LOG_DEBUG(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3283  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3284  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3285 
3286 #define UA_LOG_INFO_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3287  UA_LOG_INFO(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3288  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3289  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3290 
3291 #define UA_LOG_WARNING_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3292  UA_LOG_WARNING(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3293  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3294  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3295 
3296 #define UA_LOG_ERROR_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3297  UA_LOG_ERROR(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3298  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3299  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3300 
3301 #define UA_LOG_FATAL_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3302  UA_LOG_FATAL(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3303  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3304  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3305 
3306 
3307 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodes.h" ***********************************/
3308 
3309 /* This Source Code Form is subject to the terms of the Mozilla Public
3310 * License, v. 2.0. If a copy of the MPL was not distributed with this
3311 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3312 
3313 
3314 #ifdef __cplusplus
3315 extern "C" {
3316 #endif
3317 
3318 
3356 #define UA_NODE_BASEATTRIBUTES \
3357  UA_NodeId nodeId; \
3358  UA_NodeClass nodeClass; \
3359  UA_QualifiedName browseName; \
3360  UA_LocalizedText displayName; \
3361  UA_LocalizedText description; \
3362  UA_UInt32 writeMask; \
3363  UA_UInt32 userWriteMask; \
3364  size_t referencesSize; \
3365  UA_ReferenceNode *references;
3366 
3367 typedef struct {
3369 } UA_Node;
3370 
3436 /* Indicates whether a variable contains data inline or whether it points to an
3437  * external data source */
3438 typedef enum {
3441 } UA_ValueSource;
3442 
3443 #define UA_NODE_VARIABLEATTRIBUTES \
3444  /* Constraints on possible values */ \
3445  UA_NodeId dataType; \
3446  UA_Int32 valueRank; \
3447  size_t arrayDimensionsSize; \
3448  UA_UInt32 *arrayDimensions; \
3449  \
3450  /* The current value */ \
3451  UA_ValueSource valueSource; \
3452  union { \
3453  struct { \
3454  UA_DataValue value; \
3455  UA_ValueCallback callback; \
3456  } data; \
3457  UA_DataSource dataSource; \
3458  } value;
3459 
3460 typedef struct {
3466  UA_Boolean historizing; /* currently unsupported */
3467 } UA_VariableNode;
3468 
3481 typedef struct {
3486 
3505 typedef struct {
3509 
3510  /* Members specific to open62541 */
3512  UA_MethodCallback attachedMethod;
3513 } UA_MethodNode;
3514 
3523 typedef struct {
3526 
3527  /* Members specific to open62541 */
3529 } UA_ObjectNode;
3530 
3540 typedef struct {
3543 
3544  /* Members specific to open62541 */
3545  UA_ObjectLifecycleManagement lifecycleManagement;
3547 
3650 typedef struct {
3656 
3671 typedef struct {
3674 } UA_DataTypeNode;
3675 
3685 typedef struct {
3689 } UA_ViewNode;
3690 
3691 #ifdef __cplusplus
3692 } // extern "C"
3693 #endif
3694 
3695 
3696 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_session.h" ***********************************/
3697 
3698 /* This Source Code Form is subject to the terms of the Mozilla Public
3699 * License, v. 2.0. If a copy of the MPL was not distributed with this
3700 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3701 
3702 
3703 
3704 #define UA_MAXCONTINUATIONPOINTS 5
3705 
3708  UA_ByteString identifier;
3709  UA_BrowseDescription browseDescription;
3710  UA_UInt32 continuationIndex;
3711  UA_UInt32 maxReferences;
3712 };
3713 
3714 struct UA_Subscription;
3716 
3717 #ifdef UA_ENABLE_SUBSCRIPTIONS
3718 typedef struct UA_PublishResponseEntry {
3719  SIMPLEQ_ENTRY(UA_PublishResponseEntry) listEntry;
3720  UA_UInt32 requestId;
3721  UA_PublishResponse response;
3722 } UA_PublishResponseEntry;
3723 #endif
3724 
3725 struct UA_Session {
3737  LIST_HEAD(ContinuationPointList, ContinuationPointEntry) continuationPoints;
3738 #ifdef UA_ENABLE_SUBSCRIPTIONS
3739  UA_UInt32 lastSubscriptionID;
3740  LIST_HEAD(UA_ListOfUASubscriptions, UA_Subscription) serverSubscriptions;
3741  SIMPLEQ_HEAD(UA_ListOfQueuedPublishResponses, UA_PublishResponseEntry) responseQueue;
3742 #endif
3743 };
3744 
3745 /* Local access to the services (for startup and maintenance) uses this Session
3746  * with all possible access rights (Session ID: 1) */
3747 extern UA_Session adminSession;
3748 
3749 void UA_Session_init(UA_Session *session);
3750 void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server *server);
3751 
3752 /* If any activity on a session happens, the timeout is extended */
3753 void UA_Session_updateLifetime(UA_Session *session);
3754 
3755 #ifdef UA_ENABLE_SUBSCRIPTIONS
3756 void UA_Session_addSubscription(UA_Session *session, UA_Subscription *newSubscription);
3757 
3759 UA_Session_getSubscriptionByID(UA_Session *session, UA_UInt32 subscriptionID);
3760 
3762 UA_Session_deleteSubscription(UA_Server *server, UA_Session *session,
3763  UA_UInt32 subscriptionID);
3764 
3765 UA_UInt32
3766 UA_Session_getUniqueSubscriptionID(UA_Session *session);
3767 #endif
3768 
3773 #define UA_LOG_TRACE_SESSION(LOGGER, SESSION, MSG, ...) \
3774  UA_LOG_TRACE(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3775  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3776  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3777  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3778  ##__VA_ARGS__);
3779 
3780 #define UA_LOG_DEBUG_SESSION(LOGGER, SESSION, MSG, ...) \
3781  UA_LOG_DEBUG(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3782  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3783  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3784  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3785  ##__VA_ARGS__);
3786 
3787 #define UA_LOG_INFO_SESSION(LOGGER, SESSION, MSG, ...) \
3788  UA_LOG_INFO(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3789  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3790  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3791  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3792  ##__VA_ARGS__);
3793 
3794 #define UA_LOG_WARNING_SESSION(LOGGER, SESSION, MSG, ...) \
3795  UA_LOG_WARNING(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3796  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3797  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3798  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3799  ##__VA_ARGS__);
3800 
3801 #define UA_LOG_ERROR_SESSION(LOGGER, SESSION, MSG, ...) \
3802  UA_LOG_ERROR(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3803  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3804  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3805  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3806  ##__VA_ARGS__);
3807 
3808 #define UA_LOG_FATAL_SESSION(LOGGER, SESSION, MSG, ...) \
3809  UA_LOG_FATAL(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3810  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3811  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3812  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3813  ##__VA_ARGS__);
3814 
3815 
3816 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_subscription.h" ***********************************/
3817 
3818 /* This Source Code Form is subject to the terms of the Mozilla Public
3819 * License, v. 2.0. If a copy of the MPL was not distributed with this
3820 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3821 
3822 
3823 
3824 /*****************/
3825 /* MonitoredItem */
3826 /*****************/
3827 
3828 typedef enum {
3833 
3836  UA_UInt32 clientHandle;
3837  UA_DataValue value;
3839 
3840 typedef struct UA_MonitoredItem {
3841  LIST_ENTRY(UA_MonitoredItem) listEntry;
3842 
3843  /* Settings */
3844  UA_Subscription *subscription;
3845  UA_UInt32 itemId;
3846  UA_MonitoredItemType monitoredItemType;
3847  UA_TimestampsToReturn timestampsToReturn;
3848  UA_MonitoringMode monitoringMode;
3849  UA_NodeId monitoredNodeId;
3850  UA_UInt32 attributeID;
3851  UA_UInt32 clientHandle;
3852  UA_Double samplingInterval; // [ms]
3853  UA_UInt32 currentQueueSize;
3854  UA_UInt32 maxQueueSize;
3855  UA_Boolean discardOldest;
3856  UA_String indexRange;
3857  // TODO: dataEncoding is hardcoded to UA binary
3858  UA_DataChangeTrigger trigger;
3859 
3860  /* Sample Job */
3861  UA_Guid sampleJobGuid;
3862  UA_Boolean sampleJobIsRegistered;
3863 
3864  /* Sample Queue */
3865  UA_ByteString lastSampledValue;
3866  TAILQ_HEAD(QueueOfQueueDataValues, MonitoredItem_queuedValue) queue;
3868 
3870 void MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem);
3871 void UA_MoniteredItem_SampleCallback(UA_Server *server, UA_MonitoredItem *monitoredItem);
3874 
3875 /****************/
3876 /* Subscription */
3877 /****************/
3878 
3881  UA_NotificationMessage message;
3883 
3884 /* We use only a subset of the states defined in the standard */
3885 typedef enum {
3886  /* UA_SUBSCRIPTIONSTATE_CLOSED */
3887  /* UA_SUBSCRIPTIONSTATE_CREATING */
3892 
3894  LIST_ENTRY(UA_Subscription) listEntry;
3895 
3896  /* Settings */
3897  UA_Session *session;
3898  UA_UInt32 lifeTimeCount;
3899  UA_UInt32 maxKeepAliveCount;
3900  UA_Double publishingInterval; /* in ms */
3901  UA_UInt32 subscriptionID;
3902  UA_UInt32 notificationsPerPublish;
3903  UA_Boolean publishingEnabled;
3904  UA_UInt32 priority;
3905 
3906  /* Runtime information */
3907  UA_SubscriptionState state;
3908  UA_UInt32 sequenceNumber;
3909  UA_UInt32 currentKeepAliveCount;
3910  UA_UInt32 currentLifetimeCount;
3911  UA_UInt32 lastMonitoredItemId;
3912 
3913  /* Publish Job */
3914  UA_Guid publishJobGuid;
3915  UA_Boolean publishJobIsRegistered;
3916 
3917  /* MonitoredItems */
3918  LIST_HEAD(UA_ListOfUAMonitoredItems, UA_MonitoredItem) monitoredItems;
3919 
3920  /* Retransmission Queue */
3921  TAILQ_HEAD(UA_ListOfNotificationMessages, UA_NotificationMessageEntry) retransmissionQueue;
3922  UA_UInt32 retransmissionQueueSize;
3923 };
3924 
3925 UA_Subscription *UA_Subscription_new(UA_Session *session, UA_UInt32 subscriptionID);
3926 void UA_Subscription_deleteMembers(UA_Subscription *subscription, UA_Server *server);
3929 
3932  UA_UInt32 monitoredItemID);
3933 
3936 
3938 
3941 
3942 void
3944  UA_NodeId *sessionToken);
3945 
3946 
3947 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodestore.h" ***********************************/
3948 
3949 /* This Source Code Form is subject to the terms of the Mozilla Public
3950 * License, v. 2.0. If a copy of the MPL was not distributed with this
3951 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3952 
3953 
3954 #ifdef __cplusplus
3955 extern "C" {
3956 #endif
3957 
3958 
3964 struct UA_NodeStore;
3966 
3970 /* Create a new nodestore */
3972 
3973 /* Delete the nodestore and all nodes in it. Do not call from a read-side
3974  critical section (multithreading). */
3976 
3985 /* Create an editable node of the given NodeClass. */
3987 #define UA_NodeStore_newObjectNode() \
3988  (UA_ObjectNode*)UA_NodeStore_newNode(UA_NODECLASS_OBJECT)
3989 #define UA_NodeStore_newMethodNode() \
3990  (UA_MethodNode*)UA_NodeStore_newNode(UA_NODECLASS_METHOD)
3991 #define UA_NodeStore_newObjectTypeNode() \
3992  (UA_ObjectTypeNode*)UA_NodeStore_newNode(UA_NODECLASS_OBJECTTYPE)
3993 #define UA_NodeStore_newVariableTypeNode() \
3994  (UA_VariableTypeNode*)UA_NodeStore_newNode(UA_NODECLASS_VARIABLETYPE)
3995 #define UA_NodeStore_newReferenceTypeNode() \
3996  (UA_ReferenceTypeNode*)UA_NodeStore_newNode(UA_NODECLASS_REFERENCETYPE)
3997 #define UA_NodeStore_newDataTypeNode() \
3998  (UA_DataTypeNode*)UA_NodeStore_newNode(UA_NODECLASS_DATATYPE)
3999 #define UA_NodeStore_newViewNode() \
4000  (UA_ViewNode*)UA_NodeStore_newNode(UA_NODECLASS_VIEW)
4001 
4002 /* Enable read/write AccessLevel flags for variables by default. More complete
4003  * access control is added starting in the 0.3 branch. */
4004 static UA_VariableNode *
4005 UA_NodeStore_newVariableNode(void) {
4008  if(vn)
4009  vn->accessLevel = 3; /* Enable read/write */
4010  return vn;
4011 }
4012 
4013 /* Delete an editable node. */
4014 void UA_NodeStore_deleteNode(UA_Node *node);
4015 
4019 /* Inserts a new node into the nodestore. If the nodeid is zero, then a fresh
4020  * numeric nodeid from namespace 1 is assigned. If insertion fails, the node is
4021  * deleted. */
4023 
4024 /* The returned node is immutable. */
4025 const UA_Node * UA_NodeStore_get(UA_NodeStore *ns, const UA_NodeId *nodeid);
4026 
4027 /* Returns an editable copy of a node (needs to be deleted with the deleteNode
4028  function or inserted / replaced into the nodestore). */
4029 UA_Node * UA_NodeStore_getCopy(UA_NodeStore *ns, const UA_NodeId *nodeid);
4030 
4031 /* To replace a node, get an editable copy of the node, edit and replace with
4032  * this function. If the node was already replaced since the copy was made,
4033  * UA_STATUSCODE_BADINTERNALERROR is returned. If the nodeid is not found,
4034  * UA_STATUSCODE_BADNODEIDUNKNOWN is returned. In both error cases, the editable
4035  * node is deleted. */
4037 
4038 /* Remove a node in the nodestore. */
4040 
4046 typedef void (*UA_NodeStore_nodeVisitor)(const UA_Node *node);
4048 
4049 #ifdef __cplusplus
4050 } // extern "C"
4051 #endif
4052 
4053 
4054 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_session_manager.h" ***********************************/
4055 
4056 /* This Source Code Form is subject to the terms of the Mozilla Public
4057 * License, v. 2.0. If a copy of the MPL was not distributed with this
4058 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4059 
4060 
4061 
4062 typedef struct session_list_entry {
4063  LIST_ENTRY(session_list_entry) pointers;
4064  UA_Session session;
4066 
4067 typedef struct UA_SessionManager {
4068  LIST_HEAD(session_list, session_list_entry) sessions; // doubly-linked list of sessions
4069  UA_UInt32 currentSessionCount;
4070  UA_Server *server;
4072 
4075 
4076 /* Deletes all sessions */
4078 
4079 /* Deletes all sessions that have timed out. Deletion is implemented via a
4080  * delayed callback. So all currently scheduled jobs with a pointer to the
4081  * session can complete. */
4083  UA_DateTime nowMonotonic);
4084 
4087  const UA_CreateSessionRequest *request, UA_Session **session);
4088 
4091 
4092 UA_Session *
4094 
4095 
4096 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_securechannel_manager.h" ***********************************/
4097 
4098 /* This Source Code Form is subject to the terms of the Mozilla Public
4099 * License, v. 2.0. If a copy of the MPL was not distributed with this
4100 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4101 
4102 
4103 
4104 typedef struct channel_list_entry {
4106  LIST_ENTRY(channel_list_entry) pointers;
4108 
4109 typedef struct UA_SecureChannelManager {
4110  LIST_HEAD(channel_list, channel_list_entry) channels; // doubly-linked list of channels
4111  UA_UInt32 currentChannelCount;
4112  UA_UInt32 lastChannelId;
4113  UA_UInt32 lastTokenId;
4114  UA_Server *server;
4116 
4119 
4120 /* Remove a all securechannels */
4121 void
4123 
4124 /* Remove timed out securechannels with a delayed callback. So all currently
4125  * scheduled jobs with a pointer to a securechannel can finish first. */
4126 void
4128  UA_DateTime nowMonotonic);
4129 
4132  const UA_OpenSecureChannelRequest *request,
4133  UA_OpenSecureChannelResponse *response);
4134 
4137  const UA_OpenSecureChannelRequest *request,
4138  UA_OpenSecureChannelResponse *response);
4139 
4142 
4145 
4146 
4147 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server_internal.h" ***********************************/
4148 
4149 /* This Source Code Form is subject to the terms of the Mozilla Public
4150 * License, v. 2.0. If a copy of the MPL was not distributed with this
4151 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4152 
4153 
4154 
4155 #define ANONYMOUS_POLICY "open62541-anonymous-policy"
4156 #define USERNAME_POLICY "open62541-username-policy"
4157 
4158 /* The general idea of RCU is to delay freeing nodes (or any callback invoked
4159  * with call_rcu) until all threads have left their critical section. Thus we
4160  * can delete nodes safely in concurrent operations. The macros UA_RCU_LOCK and
4161  * UA_RCU_UNLOCK are used to test during debugging that we do not nest read-side
4162  * critical sections (although this is generally allowed). */
4163 #ifdef UA_ENABLE_MULTITHREADING
4164 # define _LGPL_SOURCE
4165 # include <urcu.h>
4166 # include <urcu/lfstack.h>
4167 # ifdef NDEBUG
4168 # define UA_RCU_LOCK() rcu_read_lock()
4169 # define UA_RCU_UNLOCK() rcu_read_unlock()
4170 # define UA_ASSERT_RCU_LOCKED()
4171 # define UA_ASSERT_RCU_UNLOCKED()
4172 # else
4173  extern UA_THREAD_LOCAL bool rcu_locked;
4174 # define UA_ASSERT_RCU_LOCKED() assert(rcu_locked)
4175 # define UA_ASSERT_RCU_UNLOCKED() assert(!rcu_locked)
4176 # define UA_RCU_LOCK() do { \
4177  UA_ASSERT_RCU_UNLOCKED(); \
4178  rcu_locked = true; \
4179  rcu_read_lock(); } while(0)
4180 # define UA_RCU_UNLOCK() do { \
4181  UA_ASSERT_RCU_LOCKED(); \
4182  rcu_locked = false; \
4183  rcu_read_unlock(); } while(0)
4184 # endif
4185 #else
4186 # define UA_RCU_LOCK()
4187 # define UA_RCU_UNLOCK()
4188 # define UA_ASSERT_RCU_LOCKED()
4189 # define UA_ASSERT_RCU_UNLOCKED()
4190 #endif
4191 
4192 
4193 #ifdef UA_ENABLE_MULTITHREADING
4194 typedef struct {
4195  UA_Server *server;
4196  pthread_t thr;
4197  UA_UInt32 counter;
4198  volatile UA_Boolean running;
4199  char padding[64 - sizeof(void*) - sizeof(pthread_t) -
4200  sizeof(UA_UInt32) - sizeof(UA_Boolean)]; // separate cache lines
4201 } UA_Worker;
4202 #endif
4203 
4204 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
4205 /* Internally used context to a session 'context' of the current mehtod call */
4206 extern UA_THREAD_LOCAL UA_Session* methodCallSession;
4207 #endif
4208 
4209 struct UA_Server {
4210  /* Meta */
4214 
4215  /* Security */
4218 
4219  /* Address Space */
4221 
4224 
4225 
4226  /* Jobs with a repetition interval */
4227  LIST_HEAD(RepeatedJobsList, RepeatedJob) repeatedJobs;
4228 
4229 #ifndef UA_ENABLE_MULTITHREADING
4230  SLIST_HEAD(DelayedJobsList, UA_DelayedJob) delayedCallbacks;
4231 #else
4232  /* Dispatch queue head for the worker threads (the tail should not be in the same cache line) */
4233  struct cds_wfcq_head dispatchQueue_head;
4234  UA_Worker *workers; /* there are nThread workers in a running server */
4235  struct cds_lfs_stack mainLoopJobs; /* Work that shall be executed only in the main loop and not
4236  by worker threads */
4237  struct DelayedJobs *delayedJobs;
4238  pthread_cond_t dispatchQueue_condition; /* so the workers don't spin if the queue is empty */
4239  pthread_mutex_t dispatchQueue_mutex; /* mutex for access to condition variable */
4240  struct cds_wfcq_tail dispatchQueue_tail; /* Dispatch queue tail for the worker threads */
4241 #endif
4242 
4243  /* Config is the last element so that MSVC allows the usernamePasswordLogins
4244  field with zero-sized array */
4245  UA_ServerConfig config;
4246 };
4247 
4248 /*****************/
4249 /* Node Handling */
4250 /*****************/
4251 
4254 
4255 /* Calls callback on the node. In the multithreaded case, the node is copied before and replaced in
4256  the nodestore. */
4258 UA_StatusCode UA_Server_editNode(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId,
4259  UA_EditNodeCallback callback, const void *data);
4260 
4261 /********************/
4262 /* Event Processing */
4263 /********************/
4264 
4265 void UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection,
4266  const UA_ByteString *message);
4267 
4268 UA_StatusCode UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data);
4269 UA_StatusCode UA_Server_delayedFree(UA_Server *server, void *data);
4270 void UA_Server_deleteAllRepeatedJobs(UA_Server *server);
4271 
4272 /* Add an existing node. The node is assumed to be "finished", i.e. no
4273  * instantiation from inheritance is necessary. Instantiationcallback and
4274  * addedNodeId may be NULL. */
4276 Service_AddNodes_existing(UA_Server *server, UA_Session *session, UA_Node *node,
4277  const UA_NodeId *parentNodeId,
4278  const UA_NodeId *referenceTypeId,
4279  const UA_NodeId *typeDefinition,
4280  UA_InstantiationCallback *instantiationCallback,
4281  UA_NodeId *addedNodeId);
4282 
4283 /*********************/
4284 /* Utility Functions */
4285 /*********************/
4286 
4288 parse_numericrange(const UA_String *str, UA_NumericRange *range);
4289 
4290 UA_UInt16 addNamespace(UA_Server *server, const UA_String name);
4291 
4292 UA_Boolean
4293 UA_Node_hasSubTypeOrInstances(const UA_Node *node);
4294 
4295 const UA_VariableTypeNode *
4296 getVariableNodeType(UA_Server *server, const UA_VariableNode *node);
4297 
4298 const UA_ObjectTypeNode *
4299 getObjectNodeType(UA_Server *server, const UA_ObjectNode *node);
4300 
4301 /* Returns an array with all subtype nodeids (including the root). Subtypes need
4302  * to have the same nodeClass as root and are (recursively) related with a
4303  * hasSubType reference. Since multi-inheritance is possible, we test for
4304  * duplicates and return evey nodeid at most once. */
4306 getTypeHierarchy(UA_NodeStore *ns, const UA_Node *rootRef, UA_Boolean inverse,
4307  UA_NodeId **typeHierarchy, size_t *typeHierarchySize);
4308 
4309 /* Recursively searches "upwards" in the tree following specific reference types */
4310 UA_Boolean
4311 isNodeInTree(UA_NodeStore *ns, const UA_NodeId *leafNode,
4312  const UA_NodeId *nodeToFind, const UA_NodeId *referenceTypeIds,
4313  size_t referenceTypeIdsSize);
4314 
4315 const UA_Node *
4316 getNodeType(UA_Server *server, const UA_Node *node);
4317 
4318 /***************************************/
4319 /* Check Information Model Consistency */
4320 /***************************************/
4321 
4323 readValueAttribute(UA_Server *server, const UA_VariableNode *vn, UA_DataValue *v);
4324 
4326 typeCheckValue(UA_Server *server, const UA_NodeId *targetDataTypeId,
4327  UA_Int32 targetValueRank, size_t targetArrayDimensionsSize,
4328  const UA_UInt32 *targetArrayDimensions, const UA_Variant *value,
4329  const UA_NumericRange *range, UA_Variant *editableValue);
4330 
4332 writeDataTypeAttribute(UA_Server *server, UA_VariableNode *node,
4333  const UA_NodeId *dataType, const UA_NodeId *constraintDataType);
4334 
4336 compatibleArrayDimensions(size_t constraintArrayDimensionsSize,
4337  const UA_UInt32 *constraintArrayDimensions,
4338  size_t testArrayDimensionsSize,
4339  const UA_UInt32 *testArrayDimensions);
4340 
4342 writeValueRankAttribute(UA_Server *server, UA_VariableNode *node, UA_Int32 valueRank,
4343  UA_Int32 constraintValueRank);
4344 
4346 writeValueAttribute(UA_Server *server, UA_VariableNode *node,
4347  const UA_DataValue *value, const UA_String *indexRange);
4348 
4349 /*******************/
4350 /* Single-Services */
4351 /*******************/
4352 
4353 /* Some services take an array of "independent" requests. The single-services
4354  are stored here to keep ua_services.h clean for documentation purposes. */
4355 
4356 void Service_Browse_single(UA_Server *server, UA_Session *session,
4357  struct ContinuationPointEntry *cp,
4358  const UA_BrowseDescription *descr,
4359  UA_UInt32 maxrefs, UA_BrowseResult *result);
4360 
4361 void Service_Read_single(UA_Server *server, UA_Session *session,
4362  UA_TimestampsToReturn timestamps,
4363  const UA_ReadValueId *id, UA_DataValue *v);
4364 
4365 void Service_Call_single(UA_Server *server, UA_Session *session,
4366  const UA_CallMethodRequest *request,
4367  UA_CallMethodResult *result);
4368 
4369 
4370 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services.h" ***********************************/
4371 
4372 /* This Source Code Form is subject to the terms of the Mozilla Public
4373 * License, v. 2.0. If a copy of the MPL was not distributed with this
4374 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4375 
4376 
4377 #ifdef __cplusplus
4378 extern "C" {
4379 #endif
4380 
4381 
4400 /* Most services take as input the server, the current session and pointers to
4401  * the request and response structures. Possible error codes are returned as
4402  * part of the response. */
4403 typedef void (*UA_Service)(UA_Server*, UA_Session*,
4404  const void *request, void *response);
4405 
4411 void Service_FindServers(UA_Server *server, UA_Session *session,
4412  const UA_FindServersRequest *request,
4413  UA_FindServersResponse *response);
4414 
4415 /* Returns the Endpoints supported by a Server and all of the configuration
4416  * information required to establish a SecureChannel and a Session. */
4417 void Service_GetEndpoints(UA_Server *server, UA_Session *session,
4418  const UA_GetEndpointsRequest *request,
4419  UA_GetEndpointsResponse *response);
4420 
4421 /* Not Implemented: Service_RegisterServer */
4422 
4429 /* Open or renew a SecureChannel that can be used to ensure Confidentiality and
4430  * Integrity for Message exchange during a Session. */
4431 void Service_OpenSecureChannel(UA_Server *server, UA_Connection *connection,
4432  const UA_OpenSecureChannelRequest *request,
4433  UA_OpenSecureChannelResponse *response);
4434 
4435 /* Used to terminate a SecureChannel. */
4436 void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel);
4437 
4443 /* Used by an OPC UA Client to create a Session and the Server returns two
4444  * values which uniquely identify the Session. The first value is the sessionId
4445  * which is used to identify the Session in the audit logs and in the Server's
4446  * address space. The second is the authenticationToken which is used to
4447  * associate an incoming request with a Session. */
4448 void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
4449  const UA_CreateSessionRequest *request,
4450  UA_CreateSessionResponse *response);
4451 
4452 /* Used by the Client to submit its SoftwareCertificates to the Server for
4453  * validation and to specify the identity of the user associated with the
4454  * Session. This Service request shall be issued by the Client before it issues
4455  * any other Service request after CreateSession. Failure to do so shall cause
4456  * the Server to close the Session. */
4457 void Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel,
4458  UA_Session *session,
4459  const UA_ActivateSessionRequest *request,
4460  UA_ActivateSessionResponse *response);
4461 
4462 /* Used to terminate a Session. */
4463 void Service_CloseSession(UA_Server *server, UA_Session *session,
4464  const UA_CloseSessionRequest *request,
4465  UA_CloseSessionResponse *response);
4466 
4467 /* Not Implemented: Service_Cancel */
4468 
4476 /* Used to add one or more Nodes into the AddressSpace hierarchy. */
4477 void Service_AddNodes(UA_Server *server, UA_Session *session,
4478  const UA_AddNodesRequest *request,
4479  UA_AddNodesResponse *response);
4480 
4481 /* Used to add one or more References to one or more Nodes. */
4482 void Service_AddReferences(UA_Server *server, UA_Session *session,
4483  const UA_AddReferencesRequest *request,
4484  UA_AddReferencesResponse *response);
4485 
4486 /* Used to delete one or more Nodes from the AddressSpace. */
4487 void Service_DeleteNodes(UA_Server *server, UA_Session *session,
4488  const UA_DeleteNodesRequest *request,
4489  UA_DeleteNodesResponse *response);
4490 
4491 /* Used to delete one or more References of a Node. */
4492 void Service_DeleteReferences(UA_Server *server, UA_Session *session,
4493  const UA_DeleteReferencesRequest *request,
4494  UA_DeleteReferencesResponse *response);
4495 
4503 /* Used to discover the References of a specified Node. The browse can be
4504  * further limited by the use of a View. This Browse Service also supports a
4505  * primitive filtering capability. */
4506 void Service_Browse(UA_Server *server, UA_Session *session,
4507  const UA_BrowseRequest *request,
4508  UA_BrowseResponse *response);
4509 
4510 /* Used to request the next set of Browse or BrowseNext response information
4511  * that is too large to be sent in a single response. "Too large" in this
4512  * context means that the Server is not able to return a larger response or that
4513  * the number of results to return exceeds the maximum number of results to
4514  * return that was specified by the Client in the original Browse request. */
4515 void Service_BrowseNext(UA_Server *server, UA_Session *session,
4516  const UA_BrowseNextRequest *request,
4517  UA_BrowseNextResponse *response);
4518 
4519 /* Used to translate textual node paths to their respective ids. */
4520 void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session,
4523 
4524 /* Used by Clients to register the Nodes that they know they will access
4525  * repeatedly (e.g. Write, Call). It allows Servers to set up anything needed so
4526  * that the access operations will be more efficient. */
4527 void Service_RegisterNodes(UA_Server *server, UA_Session *session,
4528  const UA_RegisterNodesRequest *request,
4529  UA_RegisterNodesResponse *response);
4530 
4531 /* This Service is used to unregister NodeIds that have been obtained via the
4532  * RegisterNodes service. */
4533 void Service_UnregisterNodes(UA_Server *server, UA_Session *session,
4534  const UA_UnregisterNodesRequest *request,
4535  UA_UnregisterNodesResponse *response);
4536 
4547 /* Not Implemented: Service_QueryFirst */
4548 /* Not Impelemented: Service_QueryNext */
4549 
4555 /* Used to read one or more Attributes of one or more Nodes. For constructed
4556  * Attribute values whose elements are indexed, such as an array, this Service
4557  * allows Clients to read the entire set of indexed values as a composite, to
4558  * read individual elements or to read ranges of elements of the composite. */
4559 void Service_Read(UA_Server *server, UA_Session *session,
4560  const UA_ReadRequest *request,
4561  UA_ReadResponse *response);
4562 
4563 /* Used to write one or more Attributes of one or more Nodes. For constructed
4564  * Attribute values whose elements are indexed, such as an array, this Service
4565  * allows Clients to write the entire set of indexed values as a composite, to
4566  * write individual elements or to write ranges of elements of the composite. */
4567 void Service_Write(UA_Server *server, UA_Session *session,
4568  const UA_WriteRequest *request,
4569  UA_WriteResponse *response);
4570 
4571 /* Not Implemented: Service_HistoryRead */
4572 /* Not Implemented: Service_HistoryUpdate */
4573 
4582 /* Used to call (invoke) a list of Methods. Each method call is invoked within
4583  * the context of an existing Session. If the Session is terminated, the results
4584  * of the method's execution cannot be returned to the Client and are
4585  * discarded. */
4586 void Service_Call(UA_Server *server, UA_Session *session,
4587  const UA_CallRequest *request,
4588  UA_CallResponse *response);
4589 
4596 /* Used to create and add one or more MonitoredItems to a Subscription. A
4597  * MonitoredItem is deleted automatically by the Server when the Subscription is
4598  * deleted. Deleting a MonitoredItem causes its entire set of triggered item
4599  * links to be deleted, but has no effect on the MonitoredItems referenced by
4600  * the triggered items. */
4601 void Service_CreateMonitoredItems(UA_Server *server, UA_Session *session,
4602  const UA_CreateMonitoredItemsRequest *request,
4604 
4605 /* Used to remove one or more MonitoredItems of a Subscription. When a
4606  * MonitoredItem is deleted, its triggered item links are also deleted. */
4607 void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session,
4608  const UA_DeleteMonitoredItemsRequest *request,
4610 
4611 void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session,
4612  const UA_ModifyMonitoredItemsRequest *request,
4614 
4615 /* Used to set the monitoring mode for one or more MonitoredItems of a
4616  Subscription. */
4617 void Service_SetMonitoringMode(UA_Server *server, UA_Session *session,
4618  const UA_SetMonitoringModeRequest *request,
4619  UA_SetMonitoringModeResponse *response);
4620 
4621 /* Not Implemented: Service_SetTriggering */
4622 
4627 /* Used to create a Subscription. Subscriptions monitor a set of MonitoredItems
4628  * for Notifications and return them to the Client in response to Publish
4629  * requests. */
4630 void Service_CreateSubscription(UA_Server *server, UA_Session *session,
4631  const UA_CreateSubscriptionRequest *request,
4632  UA_CreateSubscriptionResponse *response);
4633 
4634 /* Used to modify a Subscription. */
4635 void Service_ModifySubscription(UA_Server *server, UA_Session *session,
4636  const UA_ModifySubscriptionRequest *request,
4637  UA_ModifySubscriptionResponse *response);
4638 
4639 /* Used to enable sending of Notifications on one or more Subscriptions. */
4640 void Service_SetPublishingMode(UA_Server *server, UA_Session *session,
4641  const UA_SetPublishingModeRequest *request,
4642  UA_SetPublishingModeResponse *response);
4643 
4644 /* Used for two purposes. First, it is used to acknowledge the receipt of
4645  * NotificationMessages for one or more Subscriptions. Second, it is used to
4646  * request the Server to return a NotificationMessage or a keep-alive
4647  * Message.
4648  *
4649  * Note that the service signature is an exception and does not contain a
4650  * pointer to a PublishResponse. That is because the service queues up publish
4651  * requests internally and sends responses asynchronously based on timeouts. */
4652 void Service_Publish(UA_Server *server, UA_Session *session,
4653  const UA_PublishRequest *request, UA_UInt32 requestId);
4654 
4655 /* Requests the Subscription to republish a NotificationMessage from its
4656  * retransmission queue. */
4657 void Service_Republish(UA_Server *server, UA_Session *session,
4658  const UA_RepublishRequest *request,
4659  UA_RepublishResponse *response);
4660 
4661 /* Invoked to delete one or more Subscriptions that belong to the Client's
4662  * Session. */
4663 void Service_DeleteSubscriptions(UA_Server *server, UA_Session *session,
4664  const UA_DeleteSubscriptionsRequest *request,
4665  UA_DeleteSubscriptionsResponse *response);
4666 
4667 /* Not Implemented: Service_TransferSubscription */
4668 
4669 #ifdef __cplusplus
4670 } // extern "C"
4671 #endif
4672 
4673 
4674 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/client/ua_client_internal.h" ***********************************/
4675 
4676 /* This Source Code Form is subject to the terms of the Mozilla Public
4677 * License, v. 2.0. If a copy of the MPL was not distributed with this
4678 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4679 
4680 
4681 
4682 /**************************/
4683 /* Subscriptions Handling */
4684 /**************************/
4685 
4686 #ifdef UA_ENABLE_SUBSCRIPTIONS
4687 
4688 typedef struct UA_Client_NotificationsAckNumber {
4689  LIST_ENTRY(UA_Client_NotificationsAckNumber) listEntry;
4691 } UA_Client_NotificationsAckNumber;
4692 
4693 typedef struct UA_Client_MonitoredItem {
4694  LIST_ENTRY(UA_Client_MonitoredItem) listEntry;
4695  UA_UInt32 monitoredItemId;
4696  UA_UInt32 monitoringMode;
4697  UA_NodeId monitoredNodeId;
4698  UA_UInt32 attributeID;
4699  UA_UInt32 clientHandle;
4700  UA_Double samplingInterval;
4701  UA_UInt32 queueSize;
4702  UA_Boolean discardOldest;
4703  void (*handler)(UA_UInt32 monId, UA_DataValue *value, void *context);
4704  void *handlerContext;
4705 } UA_Client_MonitoredItem;
4706 
4707 typedef struct UA_Client_Subscription {
4708  LIST_ENTRY(UA_Client_Subscription) listEntry;
4709  UA_UInt32 lifeTime;
4710  UA_UInt32 keepAliveCount;
4711  UA_Double publishingInterval;
4712  UA_UInt32 subscriptionID;
4713  UA_UInt32 notificationsPerPublish;
4714  UA_UInt32 priority;
4715  LIST_HEAD(UA_ListOfClientMonitoredItems, UA_Client_MonitoredItem) monitoredItems;
4716 } UA_Client_Subscription;
4717 
4718 void UA_Client_Subscriptions_forceDelete(UA_Client *client, UA_Client_Subscription *sub);
4719 
4720 #endif
4721 
4722 /**********/
4723 /* Client */
4724 /**********/
4725 
4726 typedef enum {
4730 
4731 struct UA_Client {
4732  /* State */
4733  UA_ClientState state;
4734  UA_ClientConfig config;
4735 
4736  /* Connection */
4739 
4740  /* SecureChannel */
4744 
4745  /* Authentication */
4746  UA_Client_Authentication authenticationMethod;
4749 
4750  /* Session */
4754 
4755  /* Subscriptions */
4756 #ifdef UA_ENABLE_SUBSCRIPTIONS
4757  UA_UInt32 monitoredItemHandles;
4758  LIST_HEAD(ListOfUnacknowledgedNotifications, UA_Client_NotificationsAckNumber) pendingNotificationsAcks;
4759  LIST_HEAD(ListOfClientSubscriptionItems, UA_Client_Subscription) subscriptions;
4760 #endif
4761 };
4762 
4763 
4764 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_types.c" ***********************************/
4765 
4766 /* This Source Code Form is subject to the terms of the Mozilla Public
4767 * License, v. 2.0. If a copy of the MPL was not distributed with this
4768 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4769 
4770 
4771 
4772 /* Datatype Handling
4773  * -----------------
4774  * This file contains handling functions for the builtin types and functions
4775  * handling of structured types and arrays. These need type descriptions in a
4776  * UA_DataType structure. The UA_DataType structures as well as all non-builtin
4777  * datatypes are autogenerated. */
4778 
4779 /* Global definition of NULL type instances. These are always zeroed out, as
4780  * mandated by the C/C++ standard for global values with no initializer. */
4786 
4787 /* TODO: The standard-defined types are ordered. See if binary search is more
4788  * efficient. */
4789 const UA_DataType *
4790 UA_findDataType(const UA_NodeId *typeId) {
4791  for(size_t i = 0; i < UA_TYPES_COUNT; ++i) {
4792  if(UA_TYPES[i].typeId.identifier.numeric == typeId->identifier.numeric)
4793  return &UA_TYPES[i];
4794  }
4795  return NULL;
4796 }
4797 
4798 /***************************/
4799 /* Random Number Generator */
4800 /***************************/
4801 
4802 //static UA_THREAD_LOCAL pcg32_random_t UA_rng = PCG32_INITIALIZER;
4803 static pcg32_random_t UA_rng = PCG32_INITIALIZER;
4804 
4805 void
4807  pcg32_srandom_r(&UA_rng, seed, (uint64_t)UA_DateTime_now());
4808 }
4809 
4810 UA_UInt32
4812  return (UA_UInt32)pcg32_random_r(&UA_rng);
4813 }
4814 
4815 /*****************/
4816 /* Builtin Types */
4817 /*****************/
4818 
4819 static void deleteMembers_noInit(void *p, const UA_DataType *type);
4820 static UA_StatusCode copy_noInit(const void *src, void *dst, const UA_DataType *type);
4821 
4822 UA_String
4823 UA_String_fromChars(char const src[]) {
4824  UA_String str = UA_STRING_NULL;
4825  size_t length = strlen(src);
4826  if(length > 0) {
4827  str.data = (UA_Byte*)UA_malloc(length);
4828  if(!str.data)
4829  return str;
4830  } else {
4832  }
4833  memcpy(str.data, src, length);
4834  str.length = length;
4835  return str;
4836 }
4837 
4838 UA_Boolean
4839 UA_String_equal(const UA_String *s1, const UA_String *s2) {
4840  if(s1->length != s2->length)
4841  return false;
4842  UA_Int32 is = memcmp((char const*)s1->data,
4843  (char const*)s2->data, s1->length);
4844  return (is == 0) ? true : false;
4845 }
4846 
4847 static void
4848 String_deleteMembers(UA_String *s, const UA_DataType *_) {
4849  UA_free((void*)((uintptr_t)s->data & ~(uintptr_t)UA_EMPTY_ARRAY_SENTINEL));
4850 }
4851 
4852 /* DateTime */
4855  /* Calculating the the milli-, micro- and nanoseconds */
4856  UA_DateTimeStruct dateTimeStruct;
4857  dateTimeStruct.nanoSec = (UA_UInt16)((t % 10) * 100);
4858  dateTimeStruct.microSec = (UA_UInt16)((t % 10000) / 10);
4859  dateTimeStruct.milliSec = (UA_UInt16)((t % 10000000) / 10000);
4860 
4861  /* Calculating the unix time with #include <time.h> */
4862  time_t secSinceUnixEpoch =
4863  (time_t)((t - UA_DATETIME_UNIX_EPOCH) / UA_SEC_TO_DATETIME);
4864  struct tm ts;
4865  memset(&ts, 0, sizeof(struct tm));
4866  __secs_to_tm(secSinceUnixEpoch, &ts);
4867  dateTimeStruct.sec = (UA_UInt16)ts.tm_sec;
4868  dateTimeStruct.min = (UA_UInt16)ts.tm_min;
4869  dateTimeStruct.hour = (UA_UInt16)ts.tm_hour;
4870  dateTimeStruct.day = (UA_UInt16)ts.tm_mday;
4871  dateTimeStruct.month = (UA_UInt16)(ts.tm_mon + 1);
4872  dateTimeStruct.year = (UA_UInt16)(ts.tm_year + 1900);
4873  return dateTimeStruct;
4874 }
4875 
4876 static void
4877 printNumber(UA_UInt16 n, UA_Byte *pos, size_t digits) {
4878  for(size_t i = digits; i > 0; --i) {
4879  pos[i-1] = (UA_Byte)((n % 10) + '0');
4880  n = n / 10;
4881  }
4882 }
4883 
4884 UA_String
4886  UA_String str = UA_STRING_NULL;
4887  // length of the string is 31 (plus \0 at the end)
4888  if(!(str.data = (UA_Byte*)UA_malloc(32)))
4889  return str;
4890  str.length = 31;
4892  printNumber(tSt.month, str.data, 2);
4893  str.data[2] = '/';
4894  printNumber(tSt.day, &str.data[3], 2);
4895  str.data[5] = '/';
4896  printNumber(tSt.year, &str.data[6], 4);
4897  str.data[10] = ' ';
4898  printNumber(tSt.hour, &str.data[11], 2);
4899  str.data[13] = ':';
4900  printNumber(tSt.min, &str.data[14], 2);
4901  str.data[16] = ':';
4902  printNumber(tSt.sec, &str.data[17], 2);
4903  str.data[19] = '.';
4904  printNumber(tSt.milliSec, &str.data[20], 3);
4905  str.data[23] = '.';
4906  printNumber(tSt.microSec, &str.data[24], 3);
4907  str.data[27] = '.';
4908  printNumber(tSt.nanoSec, &str.data[28], 3);
4909  return str;
4910 }
4911 
4912 /* Guid */
4913 UA_Boolean
4914 UA_Guid_equal(const UA_Guid *g1, const UA_Guid *g2) {
4915  if(memcmp(g1, g2, sizeof(UA_Guid)) == 0)
4916  return true;
4917  return false;
4918 }
4919 
4920 UA_Guid
4922  UA_Guid result;
4923  result.data1 = (UA_UInt32)pcg32_random_r(&UA_rng);
4924  UA_UInt32 r = (UA_UInt32)pcg32_random_r(&UA_rng);
4925  result.data2 = (UA_UInt16) r;
4926  result.data3 = (UA_UInt16) (r >> 16);
4927  r = (UA_UInt32)pcg32_random_r(&UA_rng);
4928  result.data4[0] = (UA_Byte)r;
4929  result.data4[1] = (UA_Byte)(r >> 4);
4930  result.data4[2] = (UA_Byte)(r >> 8);
4931  result.data4[3] = (UA_Byte)(r >> 12);
4932  r = (UA_UInt32)pcg32_random_r(&UA_rng);
4933  result.data4[4] = (UA_Byte)r;
4934  result.data4[5] = (UA_Byte)(r >> 4);
4935  result.data4[6] = (UA_Byte)(r >> 8);
4936  result.data4[7] = (UA_Byte)(r >> 12);
4937  return result;
4938 }
4939 
4940 /* ByteString */
4943  UA_ByteString_init(bs);
4944  if(length == 0)
4945  return UA_STATUSCODE_GOOD;
4946  if(!(bs->data = (UA_Byte*)UA_malloc(length)))
4948  bs->length = length;
4949  return UA_STATUSCODE_GOOD;
4950 }
4951 
4952 /* NodeId */
4953 static void
4954 NodeId_deleteMembers(UA_NodeId *p, const UA_DataType *_) {
4955  switch(p->identifierType) {
4956  case UA_NODEIDTYPE_STRING:
4958  String_deleteMembers(&p->identifier.string, NULL);
4959  break;
4960  default: break;
4961  }
4962 }
4963 
4964 static UA_StatusCode
4965 NodeId_copy(UA_NodeId const *src, UA_NodeId *dst, const UA_DataType *_) {
4967  switch(src->identifierType) {
4968  case UA_NODEIDTYPE_NUMERIC:
4969  *dst = *src;
4970  return UA_STATUSCODE_GOOD;
4971  case UA_NODEIDTYPE_STRING:
4972  retval |= UA_String_copy(&src->identifier.string,
4973  &dst->identifier.string);
4974  break;
4975  case UA_NODEIDTYPE_GUID:
4976  retval |= UA_Guid_copy(&src->identifier.guid, &dst->identifier.guid);
4977  break;
4979  retval |= UA_ByteString_copy(&src->identifier.byteString,
4980  &dst->identifier.byteString);
4981  break;
4982  default:
4984  }
4985  dst->namespaceIndex = src->namespaceIndex;
4986  dst->identifierType = src->identifierType;
4987  return retval;
4988 }
4989 
4990 UA_Boolean
4992  if(p->namespaceIndex != 0)
4993  return false;
4994  switch(p->identifierType) {
4995  case UA_NODEIDTYPE_NUMERIC:
4996  return (p->identifier.numeric == 0);
4997  case UA_NODEIDTYPE_GUID:
4998  return (p->identifier.guid.data1 == 0 &&
4999  p->identifier.guid.data2 == 0 &&
5000  p->identifier.guid.data3 == 0 &&
5001  p->identifier.guid.data4[0] == 0 &&
5002  p->identifier.guid.data4[1] == 0 &&
5003  p->identifier.guid.data4[2] == 0 &&
5004  p->identifier.guid.data4[3] == 0 &&
5005  p->identifier.guid.data4[4] == 0 &&
5006  p->identifier.guid.data4[5] == 0 &&
5007  p->identifier.guid.data4[6] == 0 &&
5008  p->identifier.guid.data4[7] == 0);
5009  default:
5010  break;
5011  }
5012  return (p->identifier.string.length == 0);
5013 }
5014 
5015 UA_Boolean
5016 UA_NodeId_equal(const UA_NodeId *n1, const UA_NodeId *n2) {
5017  if(n1->namespaceIndex != n2->namespaceIndex ||
5018  n1->identifierType!=n2->identifierType)
5019  return false;
5020  switch(n1->identifierType) {
5021  case UA_NODEIDTYPE_NUMERIC:
5022  if(n1->identifier.numeric == n2->identifier.numeric)
5023  return true;
5024  else
5025  return false;
5026  case UA_NODEIDTYPE_STRING:
5027  return UA_String_equal(&n1->identifier.string,
5028  &n2->identifier.string);
5029  case UA_NODEIDTYPE_GUID:
5030  return UA_Guid_equal(&n1->identifier.guid,
5031  &n2->identifier.guid);
5033  return UA_ByteString_equal(&n1->identifier.byteString,
5034  &n2->identifier.byteString);
5035  }
5036  return false;
5037 }
5038 
5039 /* FNV non-cryptographic hash function. See
5040  * https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function */
5041 #define FNV_PRIME_32 16777619
5042 static UA_UInt32
5043 fnv32(UA_UInt32 fnv, const UA_Byte *buf, size_t size) {
5044  for(size_t i = 0; i < size; ++i) {
5045  fnv = fnv ^ (buf[i]);
5046  fnv = fnv * FNV_PRIME_32;
5047  }
5048  return fnv;
5049 }
5050 
5051 UA_UInt32
5053  switch(n->identifierType) {
5054  case UA_NODEIDTYPE_NUMERIC:
5055  default:
5056  return (UA_UInt32)(n->namespaceIndex + (n->identifier.numeric * 2654435761)); /* Knuth's multiplicative hashing */
5057  case UA_NODEIDTYPE_STRING:
5059  return fnv32(n->namespaceIndex, n->identifier.string.data, n->identifier.string.length);
5060  case UA_NODEIDTYPE_GUID:
5061  return fnv32(n->namespaceIndex, (const UA_Byte*)&n->identifier.guid, sizeof(UA_Guid));
5062  }
5063 }
5064 
5065 /* ExpandedNodeId */
5066 static void
5067 ExpandedNodeId_deleteMembers(UA_ExpandedNodeId *p, const UA_DataType *_) {
5068  NodeId_deleteMembers(&p->nodeId, _);
5069  String_deleteMembers(&p->namespaceUri, NULL);
5070 }
5071 
5072 static UA_StatusCode
5073 ExpandedNodeId_copy(UA_ExpandedNodeId const *src, UA_ExpandedNodeId *dst,
5074  const UA_DataType *_) {
5075  UA_StatusCode retval = NodeId_copy(&src->nodeId, &dst->nodeId, NULL);
5076  retval |= UA_String_copy(&src->namespaceUri, &dst->namespaceUri);
5077  dst->serverIndex = src->serverIndex;
5078  return retval;
5079 }
5080 
5081 /* ExtensionObject */
5082 static void
5083 ExtensionObject_deleteMembers(UA_ExtensionObject *p, const UA_DataType *_) {
5084  switch(p->encoding) {
5088  NodeId_deleteMembers(&p->content.encoded.typeId, NULL);
5089  String_deleteMembers(&p->content.encoded.body, NULL);
5090  break;
5092  if(p->content.decoded.data)
5093  UA_delete(p->content.decoded.data, p->content.decoded.type);
5094  break;
5095  default:
5096  break;
5097  }
5098 }
5099 
5100 static UA_StatusCode
5101 ExtensionObject_copy(UA_ExtensionObject const *src, UA_ExtensionObject *dst,
5102  const UA_DataType *_) {
5104  switch(src->encoding) {
5108  dst->encoding = src->encoding;
5109  retval = NodeId_copy(&src->content.encoded.typeId,
5110  &dst->content.encoded.typeId, NULL);
5111  retval |= UA_ByteString_copy(&src->content.encoded.body,
5112  &dst->content.encoded.body);
5113  break;
5116  if(!src->content.decoded.type || !src->content.decoded.data)
5119  dst->content.decoded.type = src->content.decoded.type;
5120  retval = UA_Array_copy(src->content.decoded.data, 1,
5121  &dst->content.decoded.data, src->content.decoded.type);
5122  break;
5123  default:
5124  break;
5125  }
5126  return retval;
5127 }
5128 
5129 /* Variant */
5130 static void
5131 Variant_deletemembers(UA_Variant *p, const UA_DataType *_) {
5132  if(p->storageType != UA_VARIANT_DATA)
5133  return;
5134  if(p->type && p->data > UA_EMPTY_ARRAY_SENTINEL) {
5135  if(p->arrayLength == 0)
5136  p->arrayLength = 1;
5137  UA_Array_delete(p->data, p->arrayLength, p->type);
5138  }
5141 }
5142 
5143 static UA_StatusCode
5144 Variant_copy(UA_Variant const *src, UA_Variant *dst, const UA_DataType *_) {
5145  size_t length = src->arrayLength;
5146  if(UA_Variant_isScalar(src))
5147  length = 1;
5148  UA_StatusCode retval = UA_Array_copy(src->data, length,
5149  &dst->data, src->type);
5150  if(retval != UA_STATUSCODE_GOOD)
5151  return retval;
5152  dst->arrayLength = src->arrayLength;
5153  dst->type = src->type;
5154  if(src->arrayDimensions) {
5156  (void**)&dst->arrayDimensions, &UA_TYPES[UA_TYPES_INT32]);
5157  if(retval != UA_STATUSCODE_GOOD)
5158  return retval;
5160  }
5161  return UA_STATUSCODE_GOOD;
5162 }
5163 
5164 void
5166  const UA_DataType *type) {
5167  UA_Variant_init(v);
5168  v->type = type;
5169  v->arrayLength = 0;
5170  v->data = p;
5171 }
5172 
5175  const UA_DataType *type) {
5176  void *n = UA_malloc(type->memSize);
5177  if(!n)
5179  UA_StatusCode retval = UA_copy(p, n, type);
5180  if(retval != UA_STATUSCODE_GOOD) {
5181  UA_free(n);
5182  //cppcheck-suppress memleak
5183  return retval;
5184  }
5185  UA_Variant_setScalar(v, n, type);
5186  //cppcheck-suppress memleak
5187  return UA_STATUSCODE_GOOD;
5188 }
5189 
5191  size_t arraySize, const UA_DataType *type) {
5192  UA_Variant_init(v);
5193  v->data = array;
5194  v->arrayLength = arraySize;
5195  v->type = type;
5196 }
5197 
5199 UA_Variant_setArrayCopy(UA_Variant *v, const void *array,
5200  size_t arraySize, const UA_DataType *type) {
5201  UA_Variant_init(v);
5202  UA_StatusCode retval = UA_Array_copy(array, arraySize, &v->data, type);
5203  if(retval != UA_STATUSCODE_GOOD)
5204  return retval;
5205  v->arrayLength = arraySize;
5206  v->type = type;
5207  return UA_STATUSCODE_GOOD;
5208 }
5209 
5210 /* Test if a range is compatible with a variant. If yes, the following values
5211  * are set:
5212  * - total: how many elements are in the range
5213  * - block: how big is each contiguous block of elements in the variant that
5214  * maps into the range
5215  * - stride: how many elements are between the blocks (beginning to beginning)
5216  * - first: where does the first block begin */
5217 static UA_StatusCode
5218 computeStrides(const UA_Variant *v, const UA_NumericRange range,
5219  size_t *total, size_t *block, size_t *stride, size_t *first) {
5220  /* Test for max array size */
5221 #if(MAX_SIZE > 0xffffffff) /* 64bit only */
5222  if(v->arrayLength > UA_UINT32_MAX)
5224 #endif
5225 
5226  /* Test the integrity of the source variant dimensions, make dimensions
5227  * vector of one dimension if none defined */
5228  UA_UInt32 arrayLength = (UA_UInt32)v->arrayLength;
5229  const UA_UInt32 *dims = &arrayLength;
5230  size_t dims_count = 1;
5231  if(v->arrayDimensionsSize > 0) {
5232  size_t elements = 1;
5233  dims_count = v->arrayDimensionsSize;
5234  dims = (UA_UInt32*)v->arrayDimensions;
5235  for(size_t i = 0; i < dims_count; ++i)
5236  elements *= dims[i];
5237  if(elements != v->arrayLength)
5239  }
5240  UA_assert(dims_count > 0);
5241 
5242  /* Test the integrity of the range and compute the max index used for every
5243  * dimension. The standard says in Part 4, Section 7.22:
5244  *
5245  * When reading a value, the indexes may not specify a range that is within
5246  * the bounds of the array. The Server shall return a partial result if some
5247  * elements exist within the range. */
5248  size_t count = 1;
5249  UA_UInt32 *realmax = UA_alloca(sizeof(UA_UInt32) * dims_count);
5250  if(range.dimensionsSize != dims_count)
5252  for(size_t i = 0; i < dims_count; ++i) {
5253  if(range.dimensions[i].min > range.dimensions[i].max)
5255  if(range.dimensions[i].min >= dims[i])
5257 
5258  if(range.dimensions[i].max < dims[i])
5259  realmax[i] = range.dimensions[i].max;
5260  else
5261  realmax[i] = dims[i] - 1;
5262 
5263  count *= (realmax[i] - range.dimensions[i].min) + 1;
5264  }
5265 
5266  *total = count;
5267 
5268  /* Compute the stride length and the position of the first element */
5269  *block = count; /* Assume the range describes the entire array. */
5270  *stride = v->arrayLength; /* So it can be copied as a contiguous block. */
5271  *first = 0;
5272  size_t running_dimssize = 1;
5273  UA_Boolean found_contiguous = false;
5274  for(size_t k = dims_count; k > 0;) {
5275  --k;
5276  size_t dimrange = 1 + realmax[k] - range.dimensions[k].min;
5277  if(!found_contiguous && dimrange != dims[k]) {
5278  /* Found the maximum block that can be copied contiguously */
5279  found_contiguous = true;
5280  *block = running_dimssize * dimrange;
5281  *stride = running_dimssize * dims[k];
5282  }
5283  *first += running_dimssize * range.dimensions[k].min;
5284  running_dimssize *= dims[k];
5285  }
5286  return UA_STATUSCODE_GOOD;
5287 }
5288 
5289 /* Is the type string-like? */
5290 static UA_Boolean
5291 isStringLike(const UA_DataType *type) {
5292  if(type->membersSize == 1 && type->members[0].isArray &&
5293  type->members[0].namespaceZero &&
5295  return true;
5296  return false;
5297 }
5298 
5299 /* Returns the part of the string that lies within the rangedimension */
5300 static UA_StatusCode
5301 copySubString(const UA_String *src, UA_String *dst,
5302  const UA_NumericRangeDimension *dim) {
5303  if(dim->min > dim->max)
5305  if(dim->min >= src->length)
5307 
5308  size_t length;
5309  if(dim->max < src->length)
5310  length = dim->max - dim->min + 1;
5311  else
5312  length = src->length - dim->min;
5313 
5314  UA_StatusCode retval = UA_ByteString_allocBuffer(dst, length);
5315  if(retval != UA_STATUSCODE_GOOD)
5316  return retval;
5317 
5318  memcpy(dst->data, &src->data[dim->min], length);
5319  return UA_STATUSCODE_GOOD;
5320 }
5321 
5324  const UA_NumericRange range) {
5325  UA_Boolean isScalar = UA_Variant_isScalar(src);
5326  UA_Boolean stringLike = isStringLike(src->type);
5327  UA_Variant arraySrc;
5328 
5329  /* Extract the range for copying at this level. The remaining range is dealt
5330  * with in the "scalar" type that may define an array by itself (string,
5331  * variant, ...). */
5332  UA_NumericRange thisrange, nextrange;
5333  UA_NumericRangeDimension scalarThisDimension = {0,0}; /* a single entry */
5334  if(isScalar) {
5335  /* Replace scalar src with array of length 1 */
5336  arraySrc = *src;
5337  arraySrc.arrayLength = 1;
5338  src = &arraySrc;
5339  /* Deal with all range dimensions within the scalar */
5340  thisrange.dimensions = &scalarThisDimension;
5341  thisrange.dimensionsSize = 1;
5342  nextrange = range;
5343  } else {
5344  /* Deal with as many range dimensions as possible right now */
5345  size_t dims = src->arrayDimensionsSize;
5346  if(dims == 0)
5347  dims = 1;
5348  if(dims > range.dimensionsSize)
5350  thisrange = range;
5351  thisrange.dimensionsSize = dims;
5352  nextrange.dimensions = &range.dimensions[dims];
5353  nextrange.dimensionsSize = range.dimensionsSize - dims;
5354  }
5355 
5356  /* Compute the strides */
5357  size_t count, block, stride, first;
5358  UA_StatusCode retval = computeStrides(src, thisrange, &count,
5359  &block, &stride, &first);
5360  if(retval != UA_STATUSCODE_GOOD)
5361  return retval;
5362 
5363  /* Allocate the array */
5364  UA_Variant_init(dst);
5365  dst->data = UA_Array_new(count, src->type);
5366  if(!dst->data)
5368 
5369  /* Copy the range */
5370  size_t block_count = count / block;
5371  size_t elem_size = src->type->memSize;
5372  uintptr_t nextdst = (uintptr_t)dst->data;
5373  uintptr_t nextsrc = (uintptr_t)src->data + (elem_size * first);
5374  if(nextrange.dimensionsSize == 0) {
5375  /* no nextrange */
5376  if(src->type->fixedSize) {
5377  for(size_t i = 0; i < block_count; ++i) {
5378  memcpy((void*)nextdst, (void*)nextsrc, elem_size * block);
5379  nextdst += block * elem_size;
5380  nextsrc += stride * elem_size;
5381  }
5382  } else {
5383  for(size_t i = 0; i < block_count; ++i) {
5384  for(size_t j = 0; j < block; ++j) {
5385  retval = UA_copy((const void*)nextsrc,
5386  (void*)nextdst, src->type);
5387  nextdst += elem_size;
5388  nextsrc += elem_size;
5389  }
5390  nextsrc += (stride - block) * elem_size;
5391  }
5392  }
5393  } else {
5394  /* nextrange can only be used for variants and stringlike with remaining
5395  * range of dimension 1 */
5396  if(src->type != &UA_TYPES[UA_TYPES_VARIANT]) {
5397  if(!stringLike)
5399  if(nextrange.dimensionsSize != 1)
5401  }
5402 
5403  /* Copy the content */
5404  for(size_t i = 0; i < block_count; ++i) {
5405  for(size_t j = 0; j < block && retval == UA_STATUSCODE_GOOD; ++j) {
5406  if(stringLike)
5407  retval = copySubString((const UA_String*)nextsrc,
5408  (UA_String*)nextdst,
5409  nextrange.dimensions);
5410  else
5411  retval = UA_Variant_copyRange((const UA_Variant*)nextsrc,
5412  (UA_Variant*)nextdst,
5413  nextrange);
5414  nextdst += elem_size;
5415  nextsrc += elem_size;
5416  }
5417  nextsrc += (stride - block) * elem_size;
5418  }
5419  }
5420 
5421  /* Clean up if copying failed */
5422  if(retval != UA_STATUSCODE_GOOD) {
5423  UA_Array_delete(dst->data, count, src->type);
5424  dst->data = NULL;
5425  return retval;
5426  }
5427 
5428  /* Done if scalar */
5429  dst->type = src->type;
5430  if(isScalar)
5431  return retval;
5432 
5433  /* Copy array dimensions */
5434  dst->arrayLength = count;
5435  if(src->arrayDimensionsSize > 0) {
5436  dst->arrayDimensions =
5438  if(!dst->arrayDimensions) {
5439  Variant_deletemembers(dst, NULL);
5441  }
5442  dst->arrayDimensionsSize = thisrange.dimensionsSize;
5443  for(size_t k = 0; k < thisrange.dimensionsSize; ++k)
5444  dst->arrayDimensions[k] =
5445  thisrange.dimensions[k].max - thisrange.dimensions[k].min + 1;
5446  }
5447  return UA_STATUSCODE_GOOD;
5448 }
5449 
5450 /* TODO: Allow ranges to reach inside a scalars that are array-like, e.g.
5451  * variant and strings. This is already possible for reading... */
5452 static UA_StatusCode
5453 Variant_setRange(UA_Variant *v, void *array, size_t arraySize,
5454  const UA_NumericRange range, UA_Boolean copy) {
5455  /* Compute the strides */
5456  size_t count, block, stride, first;
5457  UA_StatusCode retval = computeStrides(v, range, &count,
5458  &block, &stride, &first);
5459  if(retval != UA_STATUSCODE_GOOD)
5460  return retval;
5461  if(count != arraySize)
5463 
5464  /* Move/copy the elements */
5465  size_t block_count = count / block;
5466  size_t elem_size = v->type->memSize;
5467  uintptr_t nextdst = (uintptr_t)v->data + (first * elem_size);
5468  uintptr_t nextsrc = (uintptr_t)array;
5469  if(v->type->fixedSize || !copy) {
5470  for(size_t i = 0; i < block_count; ++i) {
5471  memcpy((void*)nextdst, (void*)nextsrc, elem_size * block);
5472  nextsrc += block * elem_size;
5473  nextdst += stride * elem_size;
5474  }
5475  } else {
5476  for(size_t i = 0; i < block_count; ++i) {
5477  for(size_t j = 0; j < block; ++j) {
5478  deleteMembers_noInit((void*)nextdst, v->type);
5479  retval |= UA_copy((void*)nextsrc, (void*)nextdst, v->type);
5480  nextdst += elem_size;
5481  nextsrc += elem_size;
5482  }
5483  nextdst += (stride - block) * elem_size;
5484  }
5485  }
5486 
5487  /* If members were moved, initialize original array to prevent reuse */
5488  if(!copy && !v->type->fixedSize)
5489  memset(array, 0, sizeof(elem_size)*arraySize);
5490 
5491  return retval;
5492 }
5493 
5496  size_t arraySize, const UA_NumericRange range) {
5497  return Variant_setRange(v, array, arraySize, range, false);
5498 }
5499 
5501 UA_Variant_setRangeCopy(UA_Variant *v, const void *array,
5502  size_t arraySize, const UA_NumericRange range) {
5503  return Variant_setRange(v, (void*)(uintptr_t)array,
5504  arraySize, range, true);
5505 }
5506 
5507 /* LocalizedText */
5508 static void
5509 LocalizedText_deleteMembers(UA_LocalizedText *p, const UA_DataType *_) {
5510  String_deleteMembers(&p->locale, NULL);
5511  String_deleteMembers(&p->text, NULL);
5512 }
5513 
5514 static UA_StatusCode
5515 LocalizedText_copy(UA_LocalizedText const *src, UA_LocalizedText *dst,
5516  const UA_DataType *_) {
5517  UA_StatusCode retval = UA_String_copy(&src->locale, &dst->locale);
5518  retval |= UA_String_copy(&src->text, &dst->text);
5519  return retval;
5520 }
5521 
5522 /* DataValue */
5523 static void
5524 DataValue_deleteMembers(UA_DataValue *p, const UA_DataType *_) {
5525  Variant_deletemembers(&p->value, NULL);
5526 }
5527 
5528 static UA_StatusCode
5529 DataValue_copy(UA_DataValue const *src, UA_DataValue *dst,
5530  const UA_DataType *_) {
5531  memcpy(dst, src, sizeof(UA_DataValue));
5532  UA_Variant_init(&dst->value);
5533  UA_StatusCode retval = Variant_copy(&src->value, &dst->value, NULL);
5534  if(retval != UA_STATUSCODE_GOOD)
5535  DataValue_deleteMembers(dst, NULL);
5536  return retval;
5537 }
5538 
5539 /* DiagnosticInfo */
5540 static void
5541 DiagnosticInfo_deleteMembers(UA_DiagnosticInfo *p, const UA_DataType *_) {
5542  String_deleteMembers(&p->additionalInfo, NULL);
5544  DiagnosticInfo_deleteMembers(p->innerDiagnosticInfo, NULL);
5546  }
5547 }
5548 
5549 static UA_StatusCode
5550 DiagnosticInfo_copy(UA_DiagnosticInfo const *src, UA_DiagnosticInfo *dst,
5551  const UA_DataType *_) {
5552  memcpy(dst, src, sizeof(UA_DiagnosticInfo));
5553  UA_String_init(&dst->additionalInfo);
5554  dst->innerDiagnosticInfo = NULL;
5556  if(src->hasAdditionalInfo)
5557  retval = UA_String_copy(&src->additionalInfo, &dst->additionalInfo);
5558  if(src->hasInnerDiagnosticInfo && src->innerDiagnosticInfo) {
5560  if(dst->innerDiagnosticInfo) {
5561  retval |= DiagnosticInfo_copy(src->innerDiagnosticInfo,
5562  dst->innerDiagnosticInfo, NULL);
5563  dst->hasInnerDiagnosticInfo = true;
5564  } else {
5565  dst->hasInnerDiagnosticInfo = false;
5566  retval |= UA_STATUSCODE_BADOUTOFMEMORY;
5567  }
5568  }
5569  return retval;
5570 }
5571 
5572 /********************/
5573 /* Structured Types */
5574 /********************/
5575 
5576 void *
5577 UA_new(const UA_DataType *type) {
5578  void *p = UA_calloc(1, type->memSize);
5579  return p;
5580 }
5581 
5582 static UA_StatusCode
5583 copyByte(const UA_Byte *src, UA_Byte *dst, const UA_DataType *_) {
5584  *dst = *src;
5585  return UA_STATUSCODE_GOOD;
5586 }
5587 
5588 static UA_StatusCode
5589 copy2Byte(const UA_UInt16 *src, UA_UInt16 *dst, const UA_DataType *_) {
5590  *dst = *src;
5591  return UA_STATUSCODE_GOOD;
5592 }
5593 
5594 static UA_StatusCode
5595 copy4Byte(const UA_UInt32 *src, UA_UInt32 *dst, const UA_DataType *_) {
5596  *dst = *src;
5597  return UA_STATUSCODE_GOOD;
5598 }
5599 
5600 static UA_StatusCode
5601 copy8Byte(const UA_UInt64 *src, UA_UInt64 *dst, const UA_DataType *_) {
5602  *dst = *src;
5603  return UA_STATUSCODE_GOOD;
5604 }
5605 
5606 static UA_StatusCode
5607 copyGuid(const UA_Guid *src, UA_Guid *dst, const UA_DataType *_) {
5608  *dst = *src;
5609  return UA_STATUSCODE_GOOD;
5610 }
5611 
5612 typedef UA_StatusCode
5613 (*UA_copySignature)(const void *src, void *dst, const UA_DataType *type);
5614 
5615 static const UA_copySignature copyJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
5616  (UA_copySignature)copyByte, // Boolean
5617  (UA_copySignature)copyByte, // SByte
5618  (UA_copySignature)copyByte, // Byte
5619  (UA_copySignature)copy2Byte, // Int16
5620  (UA_copySignature)copy2Byte, // UInt16
5621  (UA_copySignature)copy4Byte, // Int32
5622  (UA_copySignature)copy4Byte, // UInt32
5623  (UA_copySignature)copy8Byte, // Int64
5624  (UA_copySignature)copy8Byte, // UInt64
5625  (UA_copySignature)copy4Byte, // Float
5626  (UA_copySignature)copy8Byte, // Double
5627  (UA_copySignature)copy_noInit, // String
5628  (UA_copySignature)copy8Byte, // DateTime
5629  (UA_copySignature)copyGuid, // Guid
5630  (UA_copySignature)copy_noInit, // ByteString
5631  (UA_copySignature)copy_noInit, // XmlElement
5632  (UA_copySignature)NodeId_copy,
5633  (UA_copySignature)ExpandedNodeId_copy,
5634  (UA_copySignature)copy4Byte, // StatusCode
5635  (UA_copySignature)copy_noInit, // QualifiedName
5636  (UA_copySignature)LocalizedText_copy, // LocalizedText
5637  (UA_copySignature)ExtensionObject_copy,
5638  (UA_copySignature)DataValue_copy,
5639  (UA_copySignature)Variant_copy,
5640  (UA_copySignature)DiagnosticInfo_copy,
5641  (UA_copySignature)copy_noInit // all others
5642 };
5643 
5644 static UA_StatusCode
5645 copy_noInit(const void *src, void *dst, const UA_DataType *type) {
5647  uintptr_t ptrs = (uintptr_t)src;
5648  uintptr_t ptrd = (uintptr_t)dst;
5649  UA_Byte membersSize = type->membersSize;
5650  for(size_t i = 0; i < membersSize; ++i) {
5651  const UA_DataTypeMember *m= &type->members[i];
5652  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
5653  const UA_DataType *mt = &typelists[!m->namespaceZero][m->memberTypeIndex];
5654  if(!m->isArray) {
5655  ptrs += m->padding;
5656  ptrd += m->padding;
5657  size_t fi = mt->builtin ? mt->typeIndex : UA_BUILTIN_TYPES_COUNT;
5658  retval |= copyJumpTable[fi]((const void*)ptrs, (void*)ptrd, mt);
5659  ptrs += mt->memSize;
5660  ptrd += mt->memSize;
5661  } else {
5662  ptrs += m->padding;
5663  ptrd += m->padding;
5664  size_t *dst_size = (size_t*)ptrd;
5665  const size_t size = *((const size_t*)ptrs);
5666  ptrs += sizeof(size_t);
5667  ptrd += sizeof(size_t);
5668  retval |= UA_Array_copy(*(void* const*)ptrs, size, (void**)ptrd, mt);
5669  if(retval == UA_STATUSCODE_GOOD)
5670  *dst_size = size;
5671  else
5672  *dst_size = 0;
5673  ptrs += sizeof(void*);
5674  ptrd += sizeof(void*);
5675  }
5676  }
5677  return retval;
5678 }
5679 
5681 UA_copy(const void *src, void *dst, const UA_DataType *type) {
5682  memset(dst, 0, type->memSize); /* init */
5683  UA_StatusCode retval = copy_noInit(src, dst, type);
5684  if(retval != UA_STATUSCODE_GOOD)
5685  UA_deleteMembers(dst, type);
5686  return retval;
5687 }
5688 
5689 static void nopDeleteMembers(void *p, const UA_DataType *type) { }
5690 
5691 typedef void (*UA_deleteMembersSignature)(void *p, const UA_DataType *type);
5692 
5693 static const
5694 UA_deleteMembersSignature deleteMembersJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
5695  (UA_deleteMembersSignature)nopDeleteMembers, // Boolean
5696  (UA_deleteMembersSignature)nopDeleteMembers, // SByte
5697  (UA_deleteMembersSignature)nopDeleteMembers, // Byte
5698  (UA_deleteMembersSignature)nopDeleteMembers, // Int16
5699  (UA_deleteMembersSignature)nopDeleteMembers, // UInt16
5700  (UA_deleteMembersSignature)nopDeleteMembers, // Int32
5701  (UA_deleteMembersSignature)nopDeleteMembers, // UInt32
5702  (UA_deleteMembersSignature)nopDeleteMembers, // Int64
5703  (UA_deleteMembersSignature)nopDeleteMembers, // UInt64
5704  (UA_deleteMembersSignature)nopDeleteMembers, // Float
5705  (UA_deleteMembersSignature)nopDeleteMembers, // Double
5706  (UA_deleteMembersSignature)String_deleteMembers, // String
5707  (UA_deleteMembersSignature)nopDeleteMembers, // DateTime
5708  (UA_deleteMembersSignature)nopDeleteMembers, // Guid
5709  (UA_deleteMembersSignature)String_deleteMembers, // ByteString
5710  (UA_deleteMembersSignature)String_deleteMembers, // XmlElement
5711  (UA_deleteMembersSignature)NodeId_deleteMembers,
5712  (UA_deleteMembersSignature)ExpandedNodeId_deleteMembers, // ExpandedNodeId
5713  (UA_deleteMembersSignature)nopDeleteMembers, // StatusCode
5714  (UA_deleteMembersSignature)deleteMembers_noInit, // QualifiedName
5715  (UA_deleteMembersSignature)LocalizedText_deleteMembers, // LocalizedText
5716  (UA_deleteMembersSignature)ExtensionObject_deleteMembers,
5717  (UA_deleteMembersSignature)DataValue_deleteMembers,
5718  (UA_deleteMembersSignature)Variant_deletemembers,
5719  (UA_deleteMembersSignature)DiagnosticInfo_deleteMembers,
5720  (UA_deleteMembersSignature)deleteMembers_noInit,
5721 };
5722 
5723 static void
5724 deleteMembers_noInit(void *p, const UA_DataType *type) {
5725  uintptr_t ptr = (uintptr_t)p;
5726  UA_Byte membersSize = type->membersSize;
5727  for(size_t i = 0; i < membersSize; ++i) {
5728  const UA_DataTypeMember *m= &type->members[i];
5729  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
5730  const UA_DataType *mt = &typelists[!m->namespaceZero][m->memberTypeIndex];
5731  if(!m->isArray) {
5732  ptr += m->padding;
5733  size_t fi = mt->builtin ? mt->typeIndex : UA_BUILTIN_TYPES_COUNT;
5734  deleteMembersJumpTable[fi]((void*)ptr, mt);
5735  ptr += mt->memSize;
5736  } else {
5737  ptr += m->padding;
5738  size_t length = *(size_t*)ptr;
5739  ptr += sizeof(size_t);
5740  UA_Array_delete(*(void**)ptr, length, mt);
5741  ptr += sizeof(void*);
5742  }
5743  }
5744 }
5745 
5746 void
5747 UA_deleteMembers(void *p, const UA_DataType *type) {
5748  deleteMembers_noInit(p, type);
5749  memset(p, 0, type->memSize); /* init */
5750 }
5751 
5752 void
5753 UA_delete(void *p, const UA_DataType *type) {
5754  deleteMembers_noInit(p, type);
5755  UA_free(p);
5756 }
5757 
5758 /******************/
5759 /* Array Handling */
5760 /******************/
5761 
5762 void *
5763 UA_Array_new(size_t size, const UA_DataType *type) {
5764  if(size == 0)
5765  return UA_EMPTY_ARRAY_SENTINEL;
5766  return UA_calloc(size, type->memSize);
5767 }
5768 
5770 UA_Array_copy(const void *src, size_t size,
5771  void **dst, const UA_DataType *type) {
5772  if(size == 0) {
5773  if(src == NULL)
5774  *dst = NULL;
5775  else
5777  return UA_STATUSCODE_GOOD;
5778  }
5779 
5780  if(!type)
5782 
5783  /* calloc, so we don't have to check retval in every iteration of copying */
5784  *dst = UA_calloc(size, type->memSize);
5785  if(!*dst)
5787 
5788  if(type->fixedSize) {
5789  memcpy(*dst, src, type->memSize * size);
5790  return UA_STATUSCODE_GOOD;
5791  }
5792 
5793  uintptr_t ptrs = (uintptr_t)src;
5794  uintptr_t ptrd = (uintptr_t)*dst;
5796  for(size_t i = 0; i < size; ++i) {
5797  retval |= UA_copy((void*)ptrs, (void*)ptrd, type);
5798  ptrs += type->memSize;
5799  ptrd += type->memSize;
5800  }
5801  if(retval != UA_STATUSCODE_GOOD) {
5802  UA_Array_delete(*dst, size, type);
5803  *dst = NULL;
5804  }
5805  return retval;
5806 }
5807 
5808 void
5809 UA_Array_delete(void *p, size_t size, const UA_DataType *type) {
5810  if(!type->fixedSize) {
5811  uintptr_t ptr = (uintptr_t)p;
5812  for(size_t i = 0; i < size; ++i) {
5813  UA_deleteMembers((void*)ptr, type);
5814  ptr += type->memSize;
5815  }
5816  }
5817  UA_free((void*)((uintptr_t)p & ~(uintptr_t)UA_EMPTY_ARRAY_SENTINEL));
5818 }
5819 
5820 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_types_encoding_binary.c" ***********************************/
5821 
5822 /* This Source Code Form is subject to the terms of the Mozilla Public
5823  * License, v. 2.0. If a copy of the MPL was not distributed with this
5824  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5825 
5826 
5827 /* Type Encoding
5828  * -------------
5829  * This file contains encoding functions for the builtin data types and generic
5830  * functions that operate on all types and arrays. This requires the type
5831  * description from a UA_DataType structure. Note that some internal (static)
5832  * deocidng functions may abort and leave the type in an inconsistent state. But
5833  * this is always handled in UA_decodeBinary, where the error is caught and the
5834  * type cleaned up.
5835  *
5836  * Breaking a message into chunks is integrated with the encoding. When the end
5837  * of a buffer is reached, a callback is executed that sends the current buffer
5838  * as a chunk and exchanges the encoding buffer "underneath" the ongoing
5839  * encoding. This enables fast sending of large messages as spurious copying is
5840  * avoided. */
5841 
5842 #if defined(__clang__)
5843 # pragma GCC diagnostic push
5844 # pragma GCC diagnostic warning "-W#warnings"
5845 #endif
5846 
5847 #ifndef UA_BINARY_OVERLAYABLE_INTEGER
5848 # warning Integer endianness could not be detected to be little endian. Use slow generic encoding.
5849 #endif
5850 
5851 /* There is no robust way to detect float endianness in clang. This warning can be removed
5852  * if the target is known to be little endian with floats in the IEEE 754 format. */
5853 #ifndef UA_BINARY_OVERLAYABLE_FLOAT
5854 # warning Float endianness could not be detected to be little endian in the IEEE 754 format. Use slow generic encoding.
5855 #endif
5856 
5857 #if defined(__clang__)
5858 # pragma GCC diagnostic pop
5859 #endif
5860 
5861 /* Jumptables for de-/encoding and computing the buffer length. The methods in
5862  * the decoding jumptable do not all clean up their allocated memory when an
5863  * error occurs. So a final _deleteMembers needs to be called before returning
5864  * to the user. */
5865 typedef status (*UA_encodeBinarySignature)(const void *UA_RESTRICT src, const UA_DataType *type);
5867 
5868 typedef status (*UA_decodeBinarySignature)(void *UA_RESTRICT dst, const UA_DataType *type);
5870 
5871 typedef size_t (*UA_calcSizeBinarySignature)(const void *UA_RESTRICT p, const UA_DataType *contenttype);
5873 
5874 /* Pointers to the current position and the last position in the buffer */
5875 static UA_THREAD_LOCAL u8 *g_pos;
5876 static UA_THREAD_LOCAL const u8 *g_end;
5877 static UA_THREAD_LOCAL UA_ByteString g_buf;
5878 
5879 /* In UA_encodeBinaryInternal, we store a pointer to the last "good" position in
5880  * the buffer. When encoding reaches the end of the buffer, send out a chunk
5881  * until that position, replace the buffer and retry encoding after the last
5882  * "checkpoint". The status code UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED is used
5883  * exclusively to indicate that the end of the buffer was reached.
5884  *
5885  * In order to prevent restoring to an old buffer position (where the buffer was
5886  * exchanged within a call from UA_encodeBinaryInternal and is no longer
5887  * valied), no methods must return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED after
5888  * calling exchangeBuffer(). This needs to be ensured for the following methods:
5889  *
5890  * UA_encodeBinaryInternal
5891  * Array_encodeBinary
5892  * NodeId_encodeBinary
5893  * ExpandedNodeId_encodeBinary
5894  * LocalizedText_encodeBinary
5895  * ExtensionObject_encodeBinary
5896  * Variant_encodeBinary
5897  * DataValue_encodeBinary
5898  * DiagnosticInfo_encodeBinary */
5899 
5900 /* Thread-local buffers used for exchanging the buffer for chunking */
5901 static UA_THREAD_LOCAL UA_exchangeEncodeBuffer g_exchangeBufferCallback;
5902 static UA_THREAD_LOCAL void *g_exchangeBufferCallbackHandle;
5903 
5904 /* Send the current chunk and replace the buffer */
5905 static status
5906 exchangeBuffer(void) {
5907  if(!g_exchangeBufferCallback)
5909 
5910  /* Store context variables since exchangeBuffer might call UA_encode itself */
5911  UA_exchangeEncodeBuffer store_exchangeBufferCallback = g_exchangeBufferCallback;
5912  void *store_exchangeBufferCallbackHandle = g_exchangeBufferCallbackHandle;
5913  UA_ByteString buf = g_buf;
5914  size_t offset = (uintptr_t)(g_pos - g_buf.data);
5915 
5916  status ret = g_exchangeBufferCallback(g_exchangeBufferCallbackHandle, &buf, offset);
5917 
5918  /* Restore context variables */
5919  g_exchangeBufferCallback = store_exchangeBufferCallback;
5920  g_exchangeBufferCallbackHandle = store_exchangeBufferCallbackHandle;
5921  g_buf = buf;
5922  g_pos = buf.data;
5923  g_end = &buf.data[buf.length];
5924  return ret;
5925 }
5926 
5927 /*****************/
5928 /* Integer Types */
5929 /*****************/
5930 
5931 #if !UA_BINARY_OVERLAYABLE_INTEGER
5932 
5933 /* These en/decoding functions are only used when the architecture isn't little-endian. */
5934 static void
5935 UA_encode16(const u16 v, u8 buf[2]) {
5936  buf[0] = (u8)v;
5937  buf[1] = (u8)(v >> 8);
5938 }
5939 
5940 static void
5941 UA_decode16(const u8 buf[2], u16 *v) {
5942  *v = (u16)((u16)buf[0] + (((u16)buf[1]) << 8));
5943 }
5944 
5945 static void
5946 UA_encode32(const u32 v, u8 buf[4]) {
5947  buf[0] = (u8)v;
5948  buf[1] = (u8)(v >> 8);
5949  buf[2] = (u8)(v >> 16);
5950  buf[3] = (u8)(v >> 24);
5951 }
5952 
5953 static void
5954 UA_decode32(const u8 buf[4], u32 *v) {
5955  *v = (u32)((u32)buf[0] +
5956  (((u32)buf[1]) << 8) +
5957  (((u32)buf[2]) << 16) +
5958  (((u32)buf[3]) << 24));
5959 }
5960 
5961 static void
5962 UA_encode64(const u64 v, u8 buf[8]) {
5963  buf[0] = (u8)v;
5964  buf[1] = (u8)(v >> 8);
5965  buf[2] = (u8)(v >> 16);
5966  buf[3] = (u8)(v >> 24);
5967  buf[4] = (u8)(v >> 32);
5968  buf[5] = (u8)(v >> 40);
5969  buf[6] = (u8)(v >> 48);
5970  buf[7] = (u8)(v >> 56);
5971 }
5972 
5973 static void
5974 UA_decode64(const u8 buf[8], u64 *v) {
5975  *v = (u64)((u64)buf[0] +
5976  (((u64)buf[1]) << 8) +
5977  (((u64)buf[2]) << 16) +
5978  (((u64)buf[3]) << 24) +
5979  (((u64)buf[4]) << 32) +
5980  (((u64)buf[5]) << 40) +
5981  (((u64)buf[6]) << 48) +
5982  (((u64)buf[7]) << 56));
5983 }
5984 
5985 #endif /* !UA_BINARY_OVERLAYABLE_INTEGER */
5986 
5987 /* Boolean */
5988 static status
5989 Boolean_encodeBinary(const bool *src, const UA_DataType *_) {
5990  if(g_pos + sizeof(bool) > g_end)
5992  *g_pos = *(const u8*)src;
5993  ++g_pos;
5994  return UA_STATUSCODE_GOOD;
5995 }
5996 
5997 static status
5998 Boolean_decodeBinary(bool *dst, const UA_DataType *_) {
5999  if(g_pos + sizeof(bool) > g_end)
6001  *dst = (*g_pos > 0) ? true : false;
6002  ++g_pos;
6003  return UA_STATUSCODE_GOOD;
6004 }
6005 
6006 /* Byte */
6007 static status
6008 Byte_encodeBinary(const u8 *src, const UA_DataType *_) {
6009  if(g_pos + sizeof(u8) > g_end)
6011  *g_pos = *(const u8*)src;
6012  ++g_pos;
6013  return UA_STATUSCODE_GOOD;
6014 }
6015 
6016 static status
6017 Byte_decodeBinary(u8 *dst, const UA_DataType *_) {
6018  if(g_pos + sizeof(u8) > g_end)
6020  *dst = *g_pos;
6021  ++g_pos;
6022  return UA_STATUSCODE_GOOD;
6023 }
6024 
6025 /* UInt16 */
6026 static status
6027 UInt16_encodeBinary(u16 const *src, const UA_DataType *_) {
6028  if(g_pos + sizeof(u16) > g_end)
6030 #if UA_BINARY_OVERLAYABLE_INTEGER
6031  memcpy(g_pos, src, sizeof(u16));
6032 #else
6033  UA_encode16(*src, g_pos);
6034 #endif
6035  g_pos += 2;
6036  return UA_STATUSCODE_GOOD;
6037 }
6038 
6039 static status
6040 UInt16_decodeBinary(u16 *dst, const UA_DataType *_) {
6041  if(g_pos + sizeof(u16) > g_end)
6043 #if UA_BINARY_OVERLAYABLE_INTEGER
6044  memcpy(dst, g_pos, sizeof(u16));
6045 #else
6046  UA_decode16(g_pos, dst);
6047 #endif
6048  g_pos += 2;
6049  return UA_STATUSCODE_GOOD;
6050 }
6051 
6052 /* UInt32 */
6053 static status
6054 UInt32_encodeBinary(u32 const *src, const UA_DataType *_) {
6055  if(g_pos + sizeof(u32) > g_end)
6057 #if UA_BINARY_OVERLAYABLE_INTEGER
6058  memcpy(g_pos, src, sizeof(u32));
6059 #else
6060  UA_encode32(*src, g_pos);
6061 #endif
6062  g_pos += 4;
6063  return UA_STATUSCODE_GOOD;
6064 }
6065 
6066 static UA_INLINE status
6067 Int32_encodeBinary(i32 const *src) {
6068  return UInt32_encodeBinary((const u32*)src, NULL);
6069 }
6070 
6071 static status
6072 UInt32_decodeBinary(u32 *dst, const UA_DataType *_) {
6073  if(g_pos + sizeof(u32) > g_end)
6075 #if UA_BINARY_OVERLAYABLE_INTEGER
6076  memcpy(dst, g_pos, sizeof(u32));
6077 #else
6078  UA_decode32(g_pos, dst);
6079 #endif
6080  g_pos += 4;
6081  return UA_STATUSCODE_GOOD;
6082 }
6083 
6084 static UA_INLINE status
6085 Int32_decodeBinary(i32 *dst) {
6086  return UInt32_decodeBinary((u32*)dst, NULL);
6087 }
6088 
6089 static UA_INLINE status
6090 StatusCode_decodeBinary(status *dst) {
6091  return UInt32_decodeBinary((u32*)dst, NULL);
6092 }
6093 
6094 /* UInt64 */
6095 static status
6096 UInt64_encodeBinary(u64 const *src, const UA_DataType *_) {
6097  if(g_pos + sizeof(u64) > g_end)
6099 #if UA_BINARY_OVERLAYABLE_INTEGER
6100  memcpy(g_pos, src, sizeof(u64));
6101 #else
6102  UA_encode64(*src, g_pos);
6103 #endif
6104  g_pos += 8;
6105  return UA_STATUSCODE_GOOD;
6106 }
6107 
6108 static status
6109 UInt64_decodeBinary(u64 *dst, const UA_DataType *_) {
6110  if(g_pos + sizeof(u64) > g_end)
6112 #if UA_BINARY_OVERLAYABLE_INTEGER
6113  memcpy(dst, g_pos, sizeof(u64));
6114 #else
6115  UA_decode64(g_pos, dst);
6116 #endif
6117  g_pos += 8;
6118  return UA_STATUSCODE_GOOD;
6119 }
6120 
6121 static UA_INLINE status
6122 DateTime_decodeBinary(UA_DateTime *dst) {
6123  return UInt64_decodeBinary((u64*)dst, NULL);
6124 }
6125 
6126 /************************/
6127 /* Floating Point Types */
6128 /************************/
6129 
6130 #if UA_BINARY_OVERLAYABLE_FLOAT
6131 # define Float_encodeBinary UInt32_encodeBinary
6132 # define Float_decodeBinary UInt32_decodeBinary
6133 # define Double_encodeBinary UInt64_encodeBinary
6134 # define Double_decodeBinary UInt64_decodeBinary
6135 #else
6136 
6137 #include <math.h>
6138 
6139 /* Handling of IEEE754 floating point values was taken from Beej's Guide to
6140  * Network Programming (http://beej.us/guide/bgnet/) and enhanced to cover the
6141  * edge cases +/-0, +/-inf and nan. */
6142 static uint64_t
6143 pack754(long double f, unsigned bits, unsigned expbits) {
6144  unsigned significandbits = bits - expbits - 1;
6145  long double fnorm;
6146  long long sign;
6147  if (f < 0) { sign = 1; fnorm = -f; }
6148  else { sign = 0; fnorm = f; }
6149  int shift = 0;
6150  while(fnorm >= 2.0) { fnorm /= 2.0; ++shift; }
6151  while(fnorm < 1.0) { fnorm *= 2.0; --shift; }
6152  fnorm = fnorm - 1.0;
6153  long long significand = (long long)(fnorm * ((float)(1LL<<significandbits) + 0.5f));
6154  long long exponent = shift + ((1<<(expbits-1)) - 1);
6155  return (uint64_t)((sign<<(bits-1)) | (exponent<<(bits-expbits-1)) | significand);
6156 }
6157 
6158 static long double
6159 unpack754(uint64_t i, unsigned bits, unsigned expbits) {
6160  unsigned significandbits = bits - expbits - 1;
6161  long double result = (long double)(i&(uint64_t)((1LL<<significandbits)-1));
6162  result /= (1LL<<significandbits);
6163  result += 1.0f;
6164  unsigned bias = (unsigned)(1<<(expbits-1)) - 1;
6165  long long shift = (long long)((i>>significandbits) & (uint64_t)((1LL<<expbits)-1)) - bias;
6166  while(shift > 0) { result *= 2.0; --shift; }
6167  while(shift < 0) { result /= 2.0; ++shift; }
6168  result *= ((i>>(bits-1))&1)? -1.0: 1.0;
6169  return result;
6170 }
6171 
6172 /* Float */
6173 #define FLOAT_NAN 0xffc00000
6174 #define FLOAT_INF 0x7f800000
6175 #define FLOAT_NEG_INF 0xff800000
6176 #define FLOAT_NEG_ZERO 0x80000000
6177 
6178 static status
6179 Float_encodeBinary(UA_Float const *src, const UA_DataType *_) {
6180  UA_Float f = *src;
6181  u32 encoded;
6182  //cppcheck-suppress duplicateExpression
6183  if(f != f) encoded = FLOAT_NAN;
6184  else if(f == 0.0f) encoded = signbit(f) ? FLOAT_NEG_ZERO : 0;
6185  //cppcheck-suppress duplicateExpression
6186  else if(f/f != f/f) encoded = f > 0 ? FLOAT_INF : FLOAT_NEG_INF;
6187  else encoded = (u32)pack754(f, 32, 8);
6188  return UInt32_encodeBinary(&encoded, NULL);
6189 }
6190 
6191 static status
6192 Float_decodeBinary(UA_Float *dst, const UA_DataType *_) {
6193  u32 decoded;
6194  status ret = UInt32_decodeBinary(&decoded, NULL);
6195  if(ret != UA_STATUSCODE_GOOD)
6196  return ret;
6197  if(decoded == 0) *dst = 0.0f;
6198  else if(decoded == FLOAT_NEG_ZERO) *dst = -0.0f;
6199  else if(decoded == FLOAT_INF) *dst = INFINITY;
6200  else if(decoded == FLOAT_NEG_INF) *dst = -INFINITY;
6201  else if((decoded >= 0x7f800001 && decoded <= 0x7fffffff) ||
6202  (decoded >= 0xff800001 && decoded <= 0xffffffff)) *dst = NAN;
6203  else *dst = (UA_Float)unpack754(decoded, 32, 8);
6204  return UA_STATUSCODE_GOOD;
6205 }
6206 
6207 /* Double */
6208 #define DOUBLE_NAN 0xfff8000000000000L
6209 #define DOUBLE_INF 0x7ff0000000000000L
6210 #define DOUBLE_NEG_INF 0xfff0000000000000L
6211 #define DOUBLE_NEG_ZERO 0x8000000000000000L
6212 
6213 static status
6214 Double_encodeBinary(UA_Double const *src, const UA_DataType *_) {
6215  UA_Double d = *src;
6216  u64 encoded;
6217  //cppcheck-suppress duplicateExpression
6218  if(d != d) encoded = DOUBLE_NAN;
6219  else if(d == 0.0) encoded = signbit(d) ? DOUBLE_NEG_ZERO : 0;
6220  //cppcheck-suppress duplicateExpression
6221  else if(d/d != d/d) encoded = d > 0 ? DOUBLE_INF : DOUBLE_NEG_INF;
6222  else encoded = pack754(d, 64, 11);
6223  return UInt64_encodeBinary(&encoded, NULL);
6224 }
6225 
6226 static status
6227 Double_decodeBinary(UA_Double *dst, const UA_DataType *_) {
6228  u64 decoded;
6229  status ret = UInt64_decodeBinary(&decoded, NULL);
6230  if(ret != UA_STATUSCODE_GOOD)
6231  return ret;
6232  if(decoded == 0) *dst = 0.0;
6233  else if(decoded == DOUBLE_NEG_ZERO) *dst = -0.0;
6234  else if(decoded == DOUBLE_INF) *dst = INFINITY;
6235  else if(decoded == DOUBLE_NEG_INF) *dst = -INFINITY;
6236  //cppcheck-suppress redundantCondition
6237  else if((decoded >= 0x7ff0000000000001L && decoded <= 0x7fffffffffffffffL) ||
6238  (decoded >= 0xfff0000000000001L && decoded <= 0xffffffffffffffffL)) *dst = NAN;
6239  else *dst = (UA_Double)unpack754(decoded, 64, 11);
6240  return UA_STATUSCODE_GOOD;
6241 }
6242 
6243 #endif
6244 
6245 /* If encoding fails, exchange the buffer and try again. It is assumed that
6246  * encoding of numerical types never fails on a fresh buffer. */
6247 static status
6248 encodeNumericWithExchangeBuffer(const void *ptr,
6249  UA_encodeBinarySignature encodeFunc) {
6250  status ret = encodeFunc(ptr, NULL);
6252  ret = exchangeBuffer();
6253  if(ret != UA_STATUSCODE_GOOD)
6254  return ret;
6255  encodeFunc(ptr, NULL);
6256  }
6257  return UA_STATUSCODE_GOOD;
6258 }
6259 
6260 /* If the type is more complex, wrap encoding into the following method to
6261  * ensure that the buffer is exchanged with intermediate checkpoints. */
6262 static status
6263 UA_encodeBinaryInternal(const void *src, const UA_DataType *type);
6264 
6265 /******************/
6266 /* Array Handling */
6267 /******************/
6268 
6269 static status
6270 Array_encodeBinaryOverlayable(uintptr_t ptr, size_t length, size_t elementMemSize) {
6271  /* Store the number of already encoded elements */
6272  size_t finished = 0;
6273 
6274  /* Loop as long as more elements remain than fit into the chunk */
6275  while(g_end < g_pos + (elementMemSize * (length-finished))) {
6276  size_t possible = ((uintptr_t)g_end - (uintptr_t)g_pos) / (sizeof(u8) * elementMemSize);
6277  size_t possibleMem = possible * elementMemSize;
6278  memcpy(g_pos, (void*)ptr, possibleMem);
6279  g_pos += possibleMem;
6280  ptr += possibleMem;
6281  finished += possible;
6282  status ret = exchangeBuffer();
6283  if(ret != UA_STATUSCODE_GOOD)
6284  return ret;
6285  }
6286 
6287  /* Encode the remaining elements */
6288  memcpy(g_pos, (void*)ptr, elementMemSize * (length-finished));
6289  g_pos += elementMemSize * (length-finished);
6290  return UA_STATUSCODE_GOOD;
6291 }
6292 
6293 static status
6294 Array_encodeBinaryComplex(uintptr_t ptr, size_t length, const UA_DataType *type) {
6295  /* Get the encoding function for the data type. The jumptable at
6296  * UA_BUILTIN_TYPES_COUNT points to the generic UA_encodeBinary method */
6297  size_t encode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
6298  UA_encodeBinarySignature encodeType = encodeBinaryJumpTable[encode_index];
6299 
6300  /* Encode every element */
6301  for(size_t i = 0; i < length; ++i) {
6302  u8 *oldpos = g_pos;
6303  status ret = encodeType((const void*)ptr, type);
6304  ptr += type->memSize;
6305  /* Encoding failed, switch to the next chunk when possible */
6306  if(ret != UA_STATUSCODE_GOOD) {
6308  g_pos = oldpos; /* Set buffer position to the end of the last encoded element */
6309  ret = exchangeBuffer();
6310  ptr -= type->memSize; /* Undo to retry encoding the ith element */
6311  --i;
6312  }
6314  if(ret != UA_STATUSCODE_GOOD)
6315  return ret; /* Unrecoverable fail */
6316  }
6317  }
6318  return UA_STATUSCODE_GOOD;
6319 }
6320 
6321 static status
6322 Array_encodeBinary(const void *src, size_t length, const UA_DataType *type) {
6323  /* Check and convert the array length to int32 */
6324  i32 signed_length = -1;
6325  if(length > UA_INT32_MAX)
6327  if(length > 0)
6328  signed_length = (i32)length;
6329  else if(src == UA_EMPTY_ARRAY_SENTINEL)
6330  signed_length = 0;
6331 
6332  /* Encode the array length */
6333  status ret = encodeNumericWithExchangeBuffer(&signed_length,
6334  (UA_encodeBinarySignature)UInt32_encodeBinary);
6335 
6336  /* Quit early? */
6337  if(ret != UA_STATUSCODE_GOOD || length == 0)
6338  return ret;
6339 
6340  /* Encode the content */
6341  if(!type->overlayable)
6342  return Array_encodeBinaryComplex((uintptr_t)src, length, type);
6343  return Array_encodeBinaryOverlayable((uintptr_t)src, length, type->memSize);
6344 }
6345 
6346 static status
6347 Array_decodeBinary(void *UA_RESTRICT *UA_RESTRICT dst,
6348  size_t *out_length, const UA_DataType *type) {
6349  /* Decode the length */
6350  i32 signed_length;
6351  status ret = Int32_decodeBinary(&signed_length);
6352  if(ret != UA_STATUSCODE_GOOD)
6353  return ret;
6354 
6355  /* Return early for empty arrays */
6356  if(signed_length <= 0) {
6357  *out_length = 0;
6358  if(signed_length < 0)
6359  *dst = NULL;
6360  else
6361  *dst = UA_EMPTY_ARRAY_SENTINEL;
6362  return UA_STATUSCODE_GOOD;
6363  }
6364 
6365  /* Filter out arrays that can obviously not be decoded, because the message
6366  * is too small for the array length. This prevents the allocation of very
6367  * long arrays for bogus messages.*/
6368  size_t length = (size_t)signed_length;
6369  if(g_pos + ((type->memSize * length) / 32) > g_end)
6371 
6372  /* Allocate memory */
6373  *dst = UA_calloc(length, type->memSize);
6374  if(!*dst)
6376 
6377  if(type->overlayable) {
6378  /* memcpy overlayable array */
6379  if(g_end < g_pos + (type->memSize * length)) {
6380  UA_free(*dst);
6381  *dst = NULL;
6383  }
6384  memcpy(*dst, g_pos, type->memSize * length);
6385  g_pos += type->memSize * length;
6386  } else {
6387  /* Decode array members */
6388  uintptr_t ptr = (uintptr_t)*dst;
6389  size_t decode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
6390  for(size_t i = 0; i < length; ++i) {
6391  ret = decodeBinaryJumpTable[decode_index]((void*)ptr, type);
6392  if(ret != UA_STATUSCODE_GOOD) {
6393  // +1 because last element is also already initialized
6394  UA_Array_delete(*dst, i+1, type);
6395  *dst = NULL;
6396  return ret;
6397  }
6398  ptr += type->memSize;
6399  }
6400  }
6401  *out_length = length;
6402  return UA_STATUSCODE_GOOD;
6403 }
6404 
6405 /*****************/
6406 /* Builtin Types */
6407 /*****************/
6408 
6409 static status
6410 String_encodeBinary(UA_String const *src, const UA_DataType *_) {
6411  return Array_encodeBinary(src->data, src->length, &UA_TYPES[UA_TYPES_BYTE]);
6412 }
6413 
6414 static status
6415 String_decodeBinary(UA_String *dst, const UA_DataType *_) {
6416  return Array_decodeBinary((void**)&dst->data, &dst->length, &UA_TYPES[UA_TYPES_BYTE]);
6417 }
6418 
6419 static UA_INLINE status
6420 ByteString_encodeBinary(UA_ByteString const *src) {
6421  return String_encodeBinary((const UA_String*)src, NULL);
6422 }
6423 
6424 static UA_INLINE status
6425 ByteString_decodeBinary(UA_ByteString *dst) {
6426  return String_decodeBinary((UA_ByteString*)dst, NULL);
6427 }
6428 
6429 /* Guid */
6430 static status
6431 Guid_encodeBinary(UA_Guid const *src, const UA_DataType *_) {
6432  status ret = UInt32_encodeBinary(&src->data1, NULL);
6433  ret |= UInt16_encodeBinary(&src->data2, NULL);
6434  ret |= UInt16_encodeBinary(&src->data3, NULL);
6435  if(g_pos + (8*sizeof(u8)) > g_end)
6437  memcpy(g_pos, src->data4, 8*sizeof(u8));
6438  g_pos += 8;
6439  return ret;
6440 }
6441 
6442 static status
6443 Guid_decodeBinary(UA_Guid *dst, const UA_DataType *_) {
6444  status ret = UInt32_decodeBinary(&dst->data1, NULL);
6445  ret |= UInt16_decodeBinary(&dst->data2, NULL);
6446  ret |= UInt16_decodeBinary(&dst->data3, NULL);
6447  if(g_pos + (8*sizeof(u8)) > g_end)
6449  memcpy(dst->data4, g_pos, 8*sizeof(u8));
6450  g_pos += 8;
6451  return ret;
6452 }
6453 
6454 /* NodeId */
6455 #define UA_NODEIDTYPE_NUMERIC_TWOBYTE 0
6456 #define UA_NODEIDTYPE_NUMERIC_FOURBYTE 1
6457 #define UA_NODEIDTYPE_NUMERIC_COMPLETE 2
6458 
6459 #define UA_EXPANDEDNODEID_SERVERINDEX_FLAG 0x40
6460 #define UA_EXPANDEDNODEID_NAMESPACEURI_FLAG 0x80
6461 
6462 /* For ExpandedNodeId, we prefill the encoding mask. We can return
6463  * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED before encoding the string, as the
6464  * buffer is not replaced. */
6465 static status
6466 NodeId_encodeBinaryWithEncodingMask(UA_NodeId const *src, u8 encoding) {
6467  status ret = UA_STATUSCODE_GOOD;
6468  switch(src->identifierType) {
6469  case UA_NODEIDTYPE_NUMERIC:
6471  encoding |= UA_NODEIDTYPE_NUMERIC_COMPLETE;
6472  ret |= Byte_encodeBinary(&encoding, NULL);
6473  ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL);
6474  ret |= UInt32_encodeBinary(&src->identifier.numeric, NULL);
6475  } else if(src->identifier.numeric > UA_BYTE_MAX || src->namespaceIndex > 0) {
6476  encoding |= UA_NODEIDTYPE_NUMERIC_FOURBYTE;
6477  ret |= Byte_encodeBinary(&encoding, NULL);
6478  u8 nsindex = (u8)src->namespaceIndex;
6479  ret |= Byte_encodeBinary(&nsindex, NULL);
6480  u16 identifier16 = (u16)src->identifier.numeric;
6481  ret |= UInt16_encodeBinary(&identifier16, NULL);
6482  } else {
6483  encoding |= UA_NODEIDTYPE_NUMERIC_TWOBYTE;
6484  ret |= Byte_encodeBinary(&encoding, NULL);
6485  u8 identifier8 = (u8)src->identifier.numeric;
6486  ret |= Byte_encodeBinary(&identifier8, NULL);
6487  }
6488  break;
6489  case UA_NODEIDTYPE_STRING:
6490  encoding |= UA_NODEIDTYPE_STRING;
6491  ret |= Byte_encodeBinary(&encoding, NULL);
6492  ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL);
6493  if(ret != UA_STATUSCODE_GOOD)
6494  return ret;
6495  ret = String_encodeBinary(&src->identifier.string, NULL);
6496  break;
6497  case UA_NODEIDTYPE_GUID:
6498  encoding |= UA_NODEIDTYPE_GUID;
6499  ret |= Byte_encodeBinary(&encoding, NULL);
6500  ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL);
6501  ret |= Guid_encodeBinary(&src->identifier.guid, NULL);
6502  break;
6504  encoding |= UA_NODEIDTYPE_BYTESTRING;
6505  ret |= Byte_encodeBinary(&encoding, NULL);
6506  ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL);
6507  if(ret != UA_STATUSCODE_GOOD)
6508  return ret;
6509  ret = ByteString_encodeBinary(&src->identifier.byteString);
6510  break;
6511  default:
6513  }
6514  return ret;
6515 }
6516 
6517 static status
6518 NodeId_encodeBinary(UA_NodeId const *src, const UA_DataType *_) {
6519  return NodeId_encodeBinaryWithEncodingMask(src, 0);
6520 }
6521 
6522 static status
6523 NodeId_decodeBinary(UA_NodeId *dst, const UA_DataType *_) {
6524  u8 dstByte = 0, encodingByte = 0;
6525  u16 dstUInt16 = 0;
6526 
6527  /* Decode the encoding bitfield */
6528  status ret = Byte_decodeBinary(&encodingByte, NULL);
6529  if(ret != UA_STATUSCODE_GOOD)
6530  return ret;
6531 
6532  /* Filter out the bits used only for ExpandedNodeIds */
6533  encodingByte &= (u8)~(UA_EXPANDEDNODEID_SERVERINDEX_FLAG |
6535 
6536  /* Decode the namespace and identifier */
6537  switch (encodingByte) {
6540  ret = Byte_decodeBinary(&dstByte, NULL);
6541  dst->identifier.numeric = dstByte;
6542  dst->namespaceIndex = 0;
6543  break;
6546  ret |= Byte_decodeBinary(&dstByte, NULL);
6547  dst->namespaceIndex = dstByte;
6548  ret |= UInt16_decodeBinary(&dstUInt16, NULL);
6549  dst->identifier.numeric = dstUInt16;
6550  break;
6553  ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL);
6554  ret |= UInt32_decodeBinary(&dst->identifier.numeric, NULL);
6555  break;
6556  case UA_NODEIDTYPE_STRING:
6558  ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL);
6559  ret |= String_decodeBinary(&dst->identifier.string, NULL);
6560  break;
6561  case UA_NODEIDTYPE_GUID:
6563  ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL);
6564  ret |= Guid_decodeBinary(&dst->identifier.guid, NULL);
6565  break;
6568  ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL);
6569  ret |= ByteString_decodeBinary(&dst->identifier.byteString);
6570  break;
6571  default:
6573  break;
6574  }
6575  return ret;
6576 }
6577 
6578 /* ExpandedNodeId */
6579 static status
6580 ExpandedNodeId_encodeBinary(UA_ExpandedNodeId const *src, const UA_DataType *_) {
6581  /* Set up the encoding mask */
6582  u8 encoding = 0;
6583  if((void*)src->namespaceUri.data > UA_EMPTY_ARRAY_SENTINEL)
6585  if(src->serverIndex > 0)
6587 
6588  /* Encode the NodeId */
6589  status ret = NodeId_encodeBinaryWithEncodingMask(&src->nodeId, encoding);
6590  if(ret != UA_STATUSCODE_GOOD)
6591  return ret;
6592 
6593  /* Encode the namespace. Do not return
6594  * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED afterwards. */
6595  if((void*)src->namespaceUri.data > UA_EMPTY_ARRAY_SENTINEL) {
6596  ret = String_encodeBinary(&src->namespaceUri, NULL);
6598  if(ret != UA_STATUSCODE_GOOD)
6599  return ret;
6600  }
6601 
6602  /* Encode the serverIndex */
6603  if(src->serverIndex > 0)
6604  ret = encodeNumericWithExchangeBuffer(&src->serverIndex,
6605  (UA_encodeBinarySignature)UInt32_encodeBinary);
6607  return ret;
6608 }
6609 
6610 static status
6611 ExpandedNodeId_decodeBinary(UA_ExpandedNodeId *dst, const UA_DataType *_) {
6612  /* Decode the encoding mask */
6613  if(g_pos >= g_end)
6615  u8 encoding = *g_pos;
6616 
6617  /* Decode the NodeId */
6618  status ret = NodeId_decodeBinary(&dst->nodeId, NULL);
6619 
6620  /* Decode the NamespaceUri */
6621  if(encoding & UA_EXPANDEDNODEID_NAMESPACEURI_FLAG) {
6622  dst->nodeId.namespaceIndex = 0;
6623  ret |= String_decodeBinary(&dst->namespaceUri, NULL);
6624  }
6625 
6626  /* Decode the ServerIndex */
6627  if(encoding & UA_EXPANDEDNODEID_SERVERINDEX_FLAG)
6628  ret |= UInt32_decodeBinary(&dst->serverIndex, NULL);
6629  return ret;
6630 }
6631 
6632 /* LocalizedText */
6633 #define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_LOCALE 0x01
6634 #define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_TEXT 0x02
6635 
6636 static status
6637 LocalizedText_encodeBinary(UA_LocalizedText const *src, const UA_DataType *_) {
6638  /* Set up the encoding mask */
6639  u8 encoding = 0;
6640  if(src->locale.data)
6642  if(src->text.data)
6644 
6645  /* Encode the encoding byte */
6646  status ret = Byte_encodeBinary(&encoding, NULL);
6647  if(ret != UA_STATUSCODE_GOOD)
6648  return ret;
6649 
6650  /* Encode the strings */
6652  ret |= String_encodeBinary(&src->locale, NULL);
6654  ret |= String_encodeBinary(&src->text, NULL);
6656  return ret;
6657 }
6658 
6659 static status
6660 LocalizedText_decodeBinary(UA_LocalizedText *dst, const UA_DataType *_) {
6661  /* Decode the encoding mask */
6662  u8 encoding = 0;
6663  status ret = Byte_decodeBinary(&encoding, NULL);
6664 
6665  /* Decode the content */
6667  ret |= String_decodeBinary(&dst->locale, NULL);
6669  ret |= String_decodeBinary(&dst->text, NULL);
6670  return ret;
6671 }
6672 
6673 /* The binary encoding has a different nodeid from the data type. So it is not
6674  * possible to reuse UA_findDataType */
6675 static const UA_DataType *
6676 UA_findDataTypeByBinary(const UA_NodeId *typeId) {
6677  /* We only store a numeric identifier for the encoding nodeid of data types */
6678  if(typeId->identifierType != UA_NODEIDTYPE_NUMERIC)
6679  return NULL;
6680 
6681  /* Iterate over the array */
6682  for(size_t i = 0; i < UA_TYPES_COUNT; ++i) {
6683  if(UA_TYPES[i].binaryEncodingId == typeId->identifier.numeric &&
6685  return &UA_TYPES[i];
6686  }
6687  return NULL;
6688 }
6689 
6690 /* ExtensionObject */
6691 static status
6692 ExtensionObject_encodeBinary(UA_ExtensionObject const *src, const UA_DataType *_) {
6693  u8 encoding = src->encoding;
6694 
6695  /* No content or already encoded content. Do not return
6696  * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED after encoding the NodeId. */
6697  if(encoding <= UA_EXTENSIONOBJECT_ENCODED_XML) {
6698  status ret = NodeId_encodeBinary(&src->content.encoded.typeId, NULL);
6699  if(ret != UA_STATUSCODE_GOOD)
6700  return ret;
6701  ret = encodeNumericWithExchangeBuffer(&encoding,
6702  (UA_encodeBinarySignature)Byte_encodeBinary);
6703  if(ret != UA_STATUSCODE_GOOD)
6704  return ret;
6705  switch (src->encoding) {
6707  break;
6710  ret = ByteString_encodeBinary(&src->content.encoded.body);
6711  break;
6712  default:
6714  }
6715  return ret;
6716  }
6717 
6718  /* Cannot encode with no data or no type description */
6719  if(!src->content.decoded.type || !src->content.decoded.data)
6721 
6722  /* Write the NodeId for the binary encoded type. The NodeId is always
6723  * numeric, so no buffer replacement is taking place. */
6724  UA_NodeId typeId = src->content.decoded.type->typeId;
6727  typeId.identifier.numeric = src->content.decoded.type->binaryEncodingId;
6728  status ret = NodeId_encodeBinary(&typeId, NULL);
6729 
6730  /* Write the encoding byte */
6732  ret |= Byte_encodeBinary(&encoding, NULL);
6733 
6734  /* Compute the content length */
6735  const UA_DataType *type = src->content.decoded.type;
6736  size_t len = UA_calcSizeBinary(src->content.decoded.data, type);
6737 
6738  /* Encode the content length */
6739  if(len > UA_INT32_MAX)
6741  i32 signed_len = (i32)len;
6742  ret |= Int32_encodeBinary(&signed_len);
6743 
6744  /* Return early upon failures (no buffer exchange until here) */
6745  if(ret != UA_STATUSCODE_GOOD)
6746  return ret;
6747 
6748  /* Encode the content */
6749  return UA_encodeBinaryInternal(src->content.decoded.data, type);
6750 }
6751 
6752 static status
6753 ExtensionObject_decodeBinaryContent(UA_ExtensionObject *dst, const UA_NodeId *typeId) {
6754  /* Lookup the datatype */
6755  const UA_DataType *type = UA_findDataTypeByBinary(typeId);
6756 
6757  /* Unknown type, just take the binary content */
6758  if(!type) {
6760  UA_NodeId_copy(typeId, &dst->content.encoded.typeId);
6761  return ByteString_decodeBinary(&dst->content.encoded.body);
6762  }
6763 
6764  /* Allocate memory */
6765  dst->content.decoded.data = UA_new(type);
6766  if(!dst->content.decoded.data)
6768 
6769  /* Jump over the length field (TODO: check if the decoded length matches) */
6770  g_pos += 4;
6771 
6772  /* Decode */
6774  dst->content.decoded.type = type;
6775  size_t decode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
6776  return decodeBinaryJumpTable[decode_index](dst->content.decoded.data, type);
6777 }
6778 
6779 static status
6780 ExtensionObject_decodeBinary(UA_ExtensionObject *dst, const UA_DataType *_) {
6781  u8 encoding = 0;
6782  UA_NodeId binTypeId; /* Can contain a string nodeid. But no corresponding
6783  * type is then found in open62541. We only store
6784  * numerical nodeids of the binary encoding identifier.
6785  * The extenionobject will be decoded to contain a
6786  * binary blob. */
6787  UA_NodeId_init(&binTypeId);
6788  status ret = NodeId_decodeBinary(&binTypeId, NULL);
6789  ret |= Byte_decodeBinary(&encoding, NULL);
6790  if(ret != UA_STATUSCODE_GOOD) {
6791  UA_NodeId_deleteMembers(&binTypeId);
6792  return ret;
6793  }
6794 
6795  if(encoding == UA_EXTENSIONOBJECT_ENCODED_BYTESTRING) {
6796  ret = ExtensionObject_decodeBinaryContent(dst, &binTypeId);
6797  UA_NodeId_deleteMembers(&binTypeId);
6798  } else if(encoding == UA_EXTENSIONOBJECT_ENCODED_NOBODY) {
6799  dst->encoding = (UA_ExtensionObjectEncoding)encoding;
6800  dst->content.encoded.typeId = binTypeId; /* move to dst */
6801  dst->content.encoded.body = UA_BYTESTRING_NULL;
6802  } else if(encoding == UA_EXTENSIONOBJECT_ENCODED_XML) {
6803  dst->encoding = (UA_ExtensionObjectEncoding)encoding;
6804  dst->content.encoded.typeId = binTypeId; /* move to dst */
6805  ret = ByteString_decodeBinary(&dst->content.encoded.body);
6806  if(ret != UA_STATUSCODE_GOOD)
6807  UA_NodeId_deleteMembers(&dst->content.encoded.typeId);
6808  } else {
6809  UA_NodeId_deleteMembers(&binTypeId);
6811  }
6812 
6813  return ret;
6814 }
6815 
6816 /* Variant */
6817 
6818 /* Never returns UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED */
6819 static status
6820 Variant_encodeBinaryWrapExtensionObject(const UA_Variant *src, const bool isArray) {
6821  /* Default to 1 for a scalar. */
6822  size_t length = 1;
6823 
6824  /* Encode the array length if required */
6825  status ret = UA_STATUSCODE_GOOD;
6826  if(isArray) {
6827  if(src->arrayLength > UA_INT32_MAX)
6829  length = src->arrayLength;
6830  i32 encodedLength = (i32)src->arrayLength;
6831  ret = Int32_encodeBinary(&encodedLength);
6832  if(ret != UA_STATUSCODE_GOOD)
6833  return ret;
6834  }
6835 
6836  /* Set up the ExtensionObject */
6837  UA_ExtensionObject eo;
6838  UA_ExtensionObject_init(&eo);
6840  eo.content.decoded.type = src->type;
6841  const u16 memSize = src->type->memSize;
6842  uintptr_t ptr = (uintptr_t)src->data;
6843 
6844  /* Iterate over the array */
6845  for(size_t i = 0; i < length && ret == UA_STATUSCODE_GOOD; ++i) {
6846  eo.content.decoded.data = (void*)ptr;
6847  ret = UA_encodeBinaryInternal(&eo, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT]);
6848  ptr += memSize;
6849  }
6850  return ret;
6851 }
6852 
6856  UA_VARIANT_ENCODINGMASKTYPE_ARRAY = (0x01 << 7) // bit 7
6857 };
6858 
6859 static status
6860 Variant_encodeBinary(const UA_Variant *src, const UA_DataType *_) {
6861  /* Quit early for the empty variant */
6862  u8 encoding = 0;
6863  if(!src->type)
6864  return Byte_encodeBinary(&encoding, NULL);
6865 
6866  /* Set the content type in the encoding mask */
6867  const bool isBuiltin = src->type->builtin;
6868  if(isBuiltin)
6869  encoding |= UA_VARIANT_ENCODINGMASKTYPE_TYPEID_MASK & (u8)(src->type->typeIndex + 1);
6870  else
6872 
6873  /* Set the array type in the encoding mask */
6874  const bool isArray = src->arrayLength > 0 || src->data <= UA_EMPTY_ARRAY_SENTINEL;
6875  const bool hasDimensions = isArray && src->arrayDimensionsSize > 0;
6876  if(isArray) {
6878  if(hasDimensions)
6880  }
6881 
6882  /* Encode the encoding byte */
6883  status ret = Byte_encodeBinary(&encoding, NULL);
6884  if(ret != UA_STATUSCODE_GOOD)
6885  return ret;
6886 
6887  /* Encode the content */
6888  if(!isBuiltin)
6889  ret = Variant_encodeBinaryWrapExtensionObject(src, isArray);
6890  else if(!isArray)
6891  ret = UA_encodeBinaryInternal(src->data, src->type);
6892  else
6893  ret = Array_encodeBinary(src->data, src->arrayLength, src->type);
6894 
6895  /* Encode the array dimensions */
6896  if(hasDimensions && ret == UA_STATUSCODE_GOOD)
6897  ret = Array_encodeBinary(src->arrayDimensions, src->arrayDimensionsSize,
6899  return ret;
6900 }
6901 
6902 static status
6903 Variant_decodeBinaryUnwrapExtensionObject(UA_Variant *dst) {
6904  /* Save the position in the ByteString. If unwrapping is not possible, start
6905  * from here to decode a normal ExtensionObject. */
6906  u8 *old_pos = g_pos;
6907 
6908  /* Decode the DataType */
6909  UA_NodeId typeId;
6910  UA_NodeId_init(&typeId);
6911  status ret = NodeId_decodeBinary(&typeId, NULL);
6912  if(ret != UA_STATUSCODE_GOOD)
6913  return ret;
6914 
6915  /* Decode the EncodingByte */
6916  u8 encoding;
6917  ret = Byte_decodeBinary(&encoding, NULL);
6918  if(ret != UA_STATUSCODE_GOOD) {
6919  UA_NodeId_deleteMembers(&typeId);
6920  return ret;
6921  }
6922 
6923  /* Search for the datatype. Default to ExtensionObject. */
6924  if(encoding == UA_EXTENSIONOBJECT_ENCODED_BYTESTRING &&
6925  (dst->type = UA_findDataTypeByBinary(&typeId)) != NULL) {
6926  /* Jump over the length field (TODO: check if length matches) */
6927  g_pos += 4;
6928  } else {
6929  /* Reset and decode as ExtensionObject */
6931  g_pos = old_pos;
6932  UA_NodeId_deleteMembers(&typeId);
6933  }
6934 
6935  /* Allocate memory */
6936  dst->data = UA_new(dst->type);
6937  if(!dst->data)
6939 
6940  /* Decode the content */
6941  size_t decode_index = dst->type->builtin ? dst->type->typeIndex : UA_BUILTIN_TYPES_COUNT;
6942  return decodeBinaryJumpTable[decode_index](dst->data, dst->type);
6943 }
6944 
6945 /* The resulting variant always has the storagetype UA_VARIANT_DATA. */
6946 static status
6947 Variant_decodeBinary(UA_Variant *dst, const UA_DataType *_) {
6948  /* Decode the encoding byte */
6949  u8 encodingByte;
6950  status ret = Byte_decodeBinary(&encodingByte, NULL);
6951  if(ret != UA_STATUSCODE_GOOD)
6952  return ret;
6953 
6954  /* Return early for an empty variant (was already _inited) */
6955  if(encodingByte == 0)
6956  return UA_STATUSCODE_GOOD;
6957 
6958  /* Does the variant contain an array? */
6959  const bool isArray = (encodingByte & UA_VARIANT_ENCODINGMASKTYPE_ARRAY) > 0;
6960 
6961  /* Get the datatype of the content. The type must be a builtin data type.
6962  * All not-builtin types are wrapped in an ExtensionObject.
6963  * The content can not be a variant again, otherwise we may run into a stack overflow problem.
6964  * See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4233 */
6965  size_t typeIndex = (size_t)((encodingByte & UA_VARIANT_ENCODINGMASKTYPE_TYPEID_MASK) - 1);
6966  if(typeIndex > UA_TYPES_DIAGNOSTICINFO || typeIndex == UA_TYPES_VARIANT)
6968  dst->type = &UA_TYPES[typeIndex];
6969 
6970  /* Decode the content */
6971  if(isArray) {
6972  ret = Array_decodeBinary(&dst->data, &dst->arrayLength, dst->type);
6973  } else if(typeIndex != UA_TYPES_EXTENSIONOBJECT) {
6974  dst->data = UA_new(dst->type);
6975  if(!dst->data)
6977  ret = decodeBinaryJumpTable[typeIndex](dst->data, dst->type);
6978  } else {
6979  ret = Variant_decodeBinaryUnwrapExtensionObject(dst);
6980  }
6981 
6982  /* Decode array dimensions */
6983  if(isArray && (encodingByte & UA_VARIANT_ENCODINGMASKTYPE_DIMENSIONS) > 0)
6984  ret |= Array_decodeBinary((void**)&dst->arrayDimensions,
6986  return ret;
6987 }
6988 
6989 /* DataValue */
6990 static status
6991 DataValue_encodeBinary(UA_DataValue const *src, const UA_DataType *_) {
6992  /* Set up the encoding mask */
6993  u8 encodingMask = (u8)
6994  (((u8)src->hasValue) |
6995  ((u8)src->hasStatus << 1) |
6996  ((u8)src->hasSourceTimestamp << 2) |
6997  ((u8)src->hasServerTimestamp << 3) |
6998  ((u8)src->hasSourcePicoseconds << 4) |
6999  ((u8)src->hasServerPicoseconds << 5));
7000 
7001  /* Encode the encoding byte */
7002  status ret = Byte_encodeBinary(&encodingMask, NULL);
7003  if(ret != UA_STATUSCODE_GOOD)
7004  return ret;
7005 
7006  /* Encode the variant. Afterwards, do not return
7007  * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED, as the buffer might have been
7008  * exchanged during encoding of the variant. */
7009  if(src->hasValue) {
7010  ret = Variant_encodeBinary(&src->value, NULL);
7011  if(ret != UA_STATUSCODE_GOOD)
7012  return ret;
7013  }
7014 
7015  if(src->hasStatus)
7016  ret |= encodeNumericWithExchangeBuffer(&src->status,
7017  (UA_encodeBinarySignature)UInt32_encodeBinary);
7018  if(src->hasSourceTimestamp)
7019  ret |= encodeNumericWithExchangeBuffer(&src->sourceTimestamp,
7020  (UA_encodeBinarySignature)UInt64_encodeBinary);
7021  if(src->hasSourcePicoseconds)
7022  ret |= encodeNumericWithExchangeBuffer(&src->sourcePicoseconds,
7023  (UA_encodeBinarySignature)UInt16_encodeBinary);
7024  if(src->hasServerTimestamp)
7025  ret |= encodeNumericWithExchangeBuffer(&src->serverTimestamp,
7026  (UA_encodeBinarySignature)UInt64_encodeBinary);
7027  if(src->hasServerPicoseconds)
7028  ret |= encodeNumericWithExchangeBuffer(&src->serverPicoseconds,
7029  (UA_encodeBinarySignature)UInt16_encodeBinary);
7031  return ret;
7032 }
7033 
7034 #define MAX_PICO_SECONDS 9999
7035 
7036 static status
7037 DataValue_decodeBinary(UA_DataValue *dst, const UA_DataType *_) {
7038  /* Decode the encoding mask */
7039  u8 encodingMask;
7040  status ret = Byte_decodeBinary(&encodingMask, NULL);
7041  if(ret != UA_STATUSCODE_GOOD)
7042  return ret;
7043 
7044  /* Decode the content */
7045  if(encodingMask & 0x01) {
7046  dst->hasValue = true;
7047  ret |= Variant_decodeBinary(&dst->value, NULL);
7048  }
7049  if(encodingMask & 0x02) {
7050  dst->hasStatus = true;
7051  ret |= StatusCode_decodeBinary(&dst->status);
7052  }
7053  if(encodingMask & 0x04) {
7054  dst->hasSourceTimestamp = true;
7055  ret |= DateTime_decodeBinary(&dst->sourceTimestamp);
7056  }
7057  if(encodingMask & 0x10) {
7058  dst->hasSourcePicoseconds = true;
7059  ret |= UInt16_decodeBinary(&dst->sourcePicoseconds, NULL);
7062  }
7063  if(encodingMask & 0x08) {
7064  dst->hasServerTimestamp = true;
7065  ret |= DateTime_decodeBinary(&dst->serverTimestamp);
7066  }
7067  if(encodingMask & 0x20) {
7068  dst->hasServerPicoseconds = true;
7069  ret |= UInt16_decodeBinary(&dst->serverPicoseconds, NULL);
7072  }
7073  return ret;
7074 }
7075 
7076 /* DiagnosticInfo */
7077 static status
7078 DiagnosticInfo_encodeBinary(const UA_DiagnosticInfo *src, const UA_DataType *_) {
7079  /* Set up the encoding mask */
7080  u8 encodingMask = (u8)
7081  ((u8)src->hasSymbolicId | ((u8)src->hasNamespaceUri << 1) |
7082  ((u8)src->hasLocalizedText << 2) | ((u8)src->hasLocale << 3) |
7083  ((u8)src->hasAdditionalInfo << 4) | ((u8)src->hasInnerDiagnosticInfo << 5));
7084 
7085  /* Encode the numeric content */
7086  status ret = Byte_encodeBinary(&encodingMask, NULL);
7087  if(src->hasSymbolicId)
7088  ret |= Int32_encodeBinary(&src->symbolicId);
7089  if(src->hasNamespaceUri)
7090  ret |= Int32_encodeBinary(&src->namespaceUri);
7091  if(src->hasLocalizedText)
7092  ret |= Int32_encodeBinary(&src->localizedText);
7093  if(src->hasLocale)
7094  ret |= Int32_encodeBinary(&src->locale);
7095  if(ret != UA_STATUSCODE_GOOD)
7096  return ret;
7097 
7098  /* Encode the additional info */
7099  if(src->hasAdditionalInfo) {
7100  ret = String_encodeBinary(&src->additionalInfo, NULL);
7101  if(ret != UA_STATUSCODE_GOOD)
7102  return ret;
7103  }
7104 
7105  /* From here on, do not return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED, as
7106  * the buffer might have been exchanged during encoding of the string. */
7107 
7108  /* Encode the inner status code */
7109  if(src->hasInnerStatusCode) {
7110  ret = encodeNumericWithExchangeBuffer(&src->innerStatusCode,
7111  (UA_encodeBinarySignature)UInt32_encodeBinary);
7113  if(ret != UA_STATUSCODE_GOOD)
7114  return ret;
7115  }
7116 
7117  /* Encode the inner diagnostic info */
7118  if(src->hasInnerDiagnosticInfo)
7119  ret = UA_encodeBinaryInternal(src->innerDiagnosticInfo,
7121 
7123  return ret;
7124 }
7125 
7126 static status
7127 DiagnosticInfo_decodeBinary(UA_DiagnosticInfo *dst, const UA_DataType *_) {
7128  /* Decode the encoding mask */
7129  u8 encodingMask;
7130  status ret = Byte_decodeBinary(&encodingMask, NULL);
7131  if(ret != UA_STATUSCODE_GOOD)
7132  return ret;
7133 
7134  /* Decode the content */
7135  if(encodingMask & 0x01) {
7136  dst->hasSymbolicId = true;
7137  ret |= Int32_decodeBinary(&dst->symbolicId);
7138  }
7139  if(encodingMask & 0x02) {
7140  dst->hasNamespaceUri = true;
7141  ret |= Int32_decodeBinary(&dst->namespaceUri);
7142  }
7143  if(encodingMask & 0x04) {
7144  dst->hasLocalizedText = true;
7145  ret |= Int32_decodeBinary(&dst->localizedText);
7146  }
7147  if(encodingMask & 0x08) {
7148  dst->hasLocale = true;
7149  ret |= Int32_decodeBinary(&dst->locale);
7150  }
7151  if(encodingMask & 0x10) {
7152  dst->hasAdditionalInfo = true;
7153  ret |= String_decodeBinary(&dst->additionalInfo, NULL);
7154  }
7155  if(encodingMask & 0x20) {
7156  dst->hasInnerStatusCode = true;
7157  ret |= StatusCode_decodeBinary(&dst->innerStatusCode);
7158  }
7159  if(encodingMask & 0x40) {
7160  /* innerDiagnosticInfo is allocated on the heap */
7162  UA_calloc(1, sizeof(UA_DiagnosticInfo));
7163  if(!dst->innerDiagnosticInfo)
7165  dst->hasInnerDiagnosticInfo = true;
7166  ret |= DiagnosticInfo_decodeBinary(dst->innerDiagnosticInfo, NULL);
7167  }
7168  return ret;
7169 }
7170 
7171 /********************/
7172 /* Structured Types */
7173 /********************/
7174 
7175 static status
7176 UA_decodeBinaryInternal(void *dst, const UA_DataType *type);
7177 
7178 const UA_encodeBinarySignature encodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
7179  (UA_encodeBinarySignature)Boolean_encodeBinary,
7180  (UA_encodeBinarySignature)Byte_encodeBinary, // SByte
7181  (UA_encodeBinarySignature)Byte_encodeBinary,
7182  (UA_encodeBinarySignature)UInt16_encodeBinary, // Int16
7183  (UA_encodeBinarySignature)UInt16_encodeBinary,
7184  (UA_encodeBinarySignature)UInt32_encodeBinary, // Int32
7185  (UA_encodeBinarySignature)UInt32_encodeBinary,
7186  (UA_encodeBinarySignature)UInt64_encodeBinary, // Int64
7187  (UA_encodeBinarySignature)UInt64_encodeBinary,
7188  (UA_encodeBinarySignature)Float_encodeBinary,
7189  (UA_encodeBinarySignature)Double_encodeBinary,
7190  (UA_encodeBinarySignature)String_encodeBinary,
7191  (UA_encodeBinarySignature)UInt64_encodeBinary, // DateTime
7192  (UA_encodeBinarySignature)Guid_encodeBinary,
7193  (UA_encodeBinarySignature)String_encodeBinary, // ByteString
7194  (UA_encodeBinarySignature)String_encodeBinary, // XmlElement
7195  (UA_encodeBinarySignature)NodeId_encodeBinary,
7196  (UA_encodeBinarySignature)ExpandedNodeId_encodeBinary,
7197  (UA_encodeBinarySignature)UInt32_encodeBinary, // StatusCode
7198  (UA_encodeBinarySignature)UA_encodeBinaryInternal, // QualifiedName
7199  (UA_encodeBinarySignature)LocalizedText_encodeBinary,
7200  (UA_encodeBinarySignature)ExtensionObject_encodeBinary,
7201  (UA_encodeBinarySignature)DataValue_encodeBinary,
7202  (UA_encodeBinarySignature)Variant_encodeBinary,
7203  (UA_encodeBinarySignature)DiagnosticInfo_encodeBinary,
7204  (UA_encodeBinarySignature)UA_encodeBinaryInternal,
7205 };
7206 
7207 static status
7208 UA_encodeBinaryInternal(const void *src, const UA_DataType *type) {
7209  uintptr_t ptr = (uintptr_t)src;
7210  status ret = UA_STATUSCODE_GOOD;
7211  u8 membersSize = type->membersSize;
7212  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
7213  for(size_t i = 0; i < membersSize && ret == UA_STATUSCODE_GOOD; ++i) {
7214  const UA_DataTypeMember *member = &type->members[i];
7215  const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex];
7216  if(!member->isArray) {
7217  ptr += member->padding;
7218  size_t encode_index = membertype->builtin ? membertype->typeIndex : UA_BUILTIN_TYPES_COUNT;
7219  size_t memSize = membertype->memSize;
7220  u8 *oldpos = g_pos;
7221  ret = encodeBinaryJumpTable[encode_index]((const void*)ptr, membertype);
7222  ptr += memSize;
7224  g_pos = oldpos; /* exchange/send the buffer */
7225  ret = exchangeBuffer();
7226  ptr -= member->padding + memSize; /* encode the same member in the next iteration */
7227  if(ret == UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED || g_pos + memSize > g_end) {
7228  /* the send buffer is too small to encode the member, even after exchangeBuffer */
7230  }
7231  --i;
7232  }
7233  } else {
7234  ptr += member->padding;
7235  const size_t length = *((const size_t*)ptr);
7236  ptr += sizeof(size_t);
7237  ret = Array_encodeBinary(*(void *UA_RESTRICT const *)ptr, length, membertype);
7238  ptr += sizeof(void*);
7239  }
7240  }
7242  return ret;
7243 }
7244 
7245 status
7246 UA_encodeBinary(const void *src, const UA_DataType *type,
7247  UA_exchangeEncodeBuffer exchangeCallback, void *exchangeHandle,
7248  UA_ByteString *dst, size_t *offset) {
7249  /* Set the (thread-local) pointers to save function arguments */
7250  g_buf = *dst;
7251  g_pos = &dst->data[*offset];
7252  g_end = &dst->data[dst->length];
7253  g_exchangeBufferCallback = exchangeCallback;
7254  g_exchangeBufferCallbackHandle = exchangeHandle;
7255  status ret = UA_encodeBinaryInternal(src, type);
7256 
7257  /* Set the current buffer position. Beware that the buffer might have been
7258  * exchanged internally. */
7259  *dst = g_buf;
7260  *offset = (uintptr_t)(g_pos - g_buf.data);
7261  return ret;
7262 }
7263 
7264 const UA_decodeBinarySignature decodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
7265  (UA_decodeBinarySignature)Boolean_decodeBinary,
7266  (UA_decodeBinarySignature)Byte_decodeBinary, // SByte
7267  (UA_decodeBinarySignature)Byte_decodeBinary,
7268  (UA_decodeBinarySignature)UInt16_decodeBinary, // Int16
7269  (UA_decodeBinarySignature)UInt16_decodeBinary,
7270  (UA_decodeBinarySignature)UInt32_decodeBinary, // Int32
7271  (UA_decodeBinarySignature)UInt32_decodeBinary,
7272  (UA_decodeBinarySignature)UInt64_decodeBinary, // Int64
7273  (UA_decodeBinarySignature)UInt64_decodeBinary,
7274  (UA_decodeBinarySignature)Float_decodeBinary,
7275  (UA_decodeBinarySignature)Double_decodeBinary,
7276  (UA_decodeBinarySignature)String_decodeBinary,
7277  (UA_decodeBinarySignature)UInt64_decodeBinary, // DateTime
7278  (UA_decodeBinarySignature)Guid_decodeBinary,
7279  (UA_decodeBinarySignature)String_decodeBinary, // ByteString
7280  (UA_decodeBinarySignature)String_decodeBinary, // XmlElement
7281  (UA_decodeBinarySignature)NodeId_decodeBinary,
7282  (UA_decodeBinarySignature)ExpandedNodeId_decodeBinary,
7283  (UA_decodeBinarySignature)UInt32_decodeBinary, // StatusCode
7284  (UA_decodeBinarySignature)UA_decodeBinaryInternal, // QualifiedName
7285  (UA_decodeBinarySignature)LocalizedText_decodeBinary,
7286  (UA_decodeBinarySignature)ExtensionObject_decodeBinary,
7287  (UA_decodeBinarySignature)DataValue_decodeBinary,
7288  (UA_decodeBinarySignature)Variant_decodeBinary,
7289  (UA_decodeBinarySignature)DiagnosticInfo_decodeBinary,
7290  (UA_decodeBinarySignature)UA_decodeBinaryInternal
7291 };
7292 
7293 static status
7294 UA_decodeBinaryInternal(void *dst, const UA_DataType *type) {
7295  uintptr_t ptr = (uintptr_t)dst;
7296  status ret = UA_STATUSCODE_GOOD;
7297  u8 membersSize = type->membersSize;
7298  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
7299  for(size_t i = 0; i < membersSize && ret == UA_STATUSCODE_GOOD; ++i) {
7300  const UA_DataTypeMember *member = &type->members[i];
7301  const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex];
7302  if(!member->isArray) {
7303  ptr += member->padding;
7304  size_t fi = membertype->builtin ? membertype->typeIndex : UA_BUILTIN_TYPES_COUNT;
7305  size_t memSize = membertype->memSize;
7306  ret |= decodeBinaryJumpTable[fi]((void *UA_RESTRICT)ptr, membertype);
7307  ptr += memSize;
7308  } else {
7309  ptr += member->padding;
7310  size_t *length = (size_t*)ptr;
7311  ptr += sizeof(size_t);
7312  ret |= Array_decodeBinary((void *UA_RESTRICT *UA_RESTRICT)ptr, length, membertype);
7313  ptr += sizeof(void*);
7314  }
7315  }
7316  return ret;
7317 }
7318 
7319 status
7320 UA_decodeBinary(const UA_ByteString *src, size_t *offset, void *dst,
7321  const UA_DataType *type) {
7322  /* Initialize the destination */
7323  memset(dst, 0, type->memSize);
7324 
7325  /* Set the (thread-local) position and end pointers to save function
7326  * arguments */
7327  g_pos = &src->data[*offset];
7328  g_end = &src->data[src->length];
7329 
7330  /* Decode */
7331  status ret = UA_decodeBinaryInternal(dst, type);
7332 
7333  /* Clean up */
7334  if(ret == UA_STATUSCODE_GOOD)
7335  *offset = (size_t)(g_pos - src->data) / sizeof(u8);
7336  else
7337  UA_deleteMembers(dst, type);
7338  return ret;
7339 }
7340 
7341 /******************/
7342 /* CalcSizeBinary */
7343 /******************/
7344 
7345 static size_t
7346 Array_calcSizeBinary(const void *src, size_t length, const UA_DataType *type) {
7347  size_t s = 4; // length
7348  if(type->overlayable) {
7349  s += type->memSize * length;
7350  return s;
7351  }
7352  uintptr_t ptr = (uintptr_t)src;
7353  size_t encode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
7354  for(size_t i = 0; i < length; ++i) {
7355  s += calcSizeBinaryJumpTable[encode_index]((const void*)ptr, type);
7356  ptr += type->memSize;
7357  }
7358  return s;
7359 }
7360 
7361 static size_t
7362 calcSizeBinaryMemSize(const void *UA_RESTRICT p, const UA_DataType *type) {
7363  return type->memSize;
7364 }
7365 
7366 static size_t
7367 String_calcSizeBinary(const UA_String *UA_RESTRICT p, const UA_DataType *_) {
7368  return 4 + p->length;
7369 }
7370 
7371 static size_t
7372 Guid_calcSizeBinary(const UA_Guid *UA_RESTRICT p, const UA_DataType *_) {
7373  return 16;
7374 }
7375 
7376 static size_t
7377 NodeId_calcSizeBinary(const UA_NodeId *UA_RESTRICT src, const UA_DataType *_) {
7378  size_t s = 1; // encoding byte
7379  switch (src->identifierType) {
7380  case UA_NODEIDTYPE_NUMERIC:
7381  if(src->identifier.numeric > UA_UINT16_MAX || src->namespaceIndex > UA_BYTE_MAX) {
7382  s += 6;
7383  } else if(src->identifier.numeric > UA_BYTE_MAX || src->namespaceIndex > 0) {
7384  s += 3;
7385  } else {
7386  s += 1;
7387  }
7388  break;
7390  case UA_NODEIDTYPE_STRING:
7391  s += 2;
7392  s += String_calcSizeBinary(&src->identifier.string, NULL);
7393  break;
7394  case UA_NODEIDTYPE_GUID:
7395  s += 18;
7396  break;
7397  default:
7398  return 0;
7399  }
7400  return s;
7401 }
7402 
7403 static size_t
7404 ExpandedNodeId_calcSizeBinary(const UA_ExpandedNodeId *src, const UA_DataType *_) {
7405  size_t s = NodeId_calcSizeBinary(&src->nodeId, NULL);
7406  if(src->namespaceUri.length > 0)
7407  s += String_calcSizeBinary(&src->namespaceUri, NULL);
7408  if(src->serverIndex > 0)
7409  s += 4;
7410  return s;
7411 }
7412 
7413 static size_t
7414 LocalizedText_calcSizeBinary(const UA_LocalizedText *src, UA_DataType *_) {
7415  size_t s = 1; // encoding byte
7416  if(src->locale.data)
7417  s += String_calcSizeBinary(&src->locale, NULL);
7418  if(src->text.data)
7419  s += String_calcSizeBinary(&src->text, NULL);
7420  return s;
7421 }
7422 
7423 static size_t
7424 ExtensionObject_calcSizeBinary(const UA_ExtensionObject *src, UA_DataType *_) {
7425  size_t s = 1; // encoding byte
7427  if(!src->content.decoded.type || !src->content.decoded.data)
7428  return 0;
7429  if(src->content.decoded.type->typeId.identifierType != UA_NODEIDTYPE_NUMERIC)
7430  return 0;
7431  s += NodeId_calcSizeBinary(&src->content.decoded.type->typeId, NULL);
7432  s += 4; // length
7433  const UA_DataType *type = src->content.decoded.type;
7434  size_t encode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
7435  s += calcSizeBinaryJumpTable[encode_index](src->content.decoded.data, type);
7436  } else {
7437  s += NodeId_calcSizeBinary(&src->content.encoded.typeId, NULL);
7438  switch (src->encoding) {
7440  break;
7443  s += String_calcSizeBinary(&src->content.encoded.body, NULL);
7444  break;
7445  default:
7446  return 0;
7447  }
7448  }
7449  return s;
7450 }
7451 
7452 static size_t
7453 Variant_calcSizeBinary(UA_Variant const *src, UA_DataType *_) {
7454  size_t s = 1; /* encoding byte */
7455  if(!src->type)
7456  return s;
7457 
7458  bool isArray = src->arrayLength > 0 || src->data <= UA_EMPTY_ARRAY_SENTINEL;
7459  bool hasDimensions = isArray && src->arrayDimensionsSize > 0;
7460  bool isBuiltin = src->type->builtin;
7461 
7462  UA_NodeId typeId;
7463  UA_NodeId_init(&typeId);
7464  size_t encode_index = src->type->typeIndex;
7465  if(!isBuiltin) {
7466  encode_index = UA_BUILTIN_TYPES_COUNT;
7467  typeId = src->type->typeId;
7469  return 0;
7470  }
7471 
7472  size_t length = src->arrayLength;
7473  if(isArray)
7474  s += 4;
7475  else
7476  length = 1;
7477 
7478  uintptr_t ptr = (uintptr_t)src->data;
7479  size_t memSize = src->type->memSize;
7480  for(size_t i = 0; i < length; ++i) {
7481  if(!isBuiltin) {
7482  /* The type is wrapped inside an extensionobject */
7483  s += NodeId_calcSizeBinary(&typeId, NULL);
7484  s += 1 + 4; // encoding byte + length
7485  }
7486  s += calcSizeBinaryJumpTable[encode_index]((const void*)ptr, src->type);
7487  ptr += memSize;
7488  }
7489 
7490  if(hasDimensions)
7491  s += Array_calcSizeBinary(src->arrayDimensions, src->arrayDimensionsSize,
7493  return s;
7494 }
7495 
7496 static size_t
7497 DataValue_calcSizeBinary(const UA_DataValue *src, UA_DataType *_) {
7498  size_t s = 1; // encoding byte
7499  if(src->hasValue)
7500  s += Variant_calcSizeBinary(&src->value, NULL);
7501  if(src->hasStatus)
7502  s += 4;
7503  if(src->hasSourceTimestamp)
7504  s += 8;
7505  if(src->hasSourcePicoseconds)
7506  s += 2;
7507  if(src->hasServerTimestamp)
7508  s += 8;
7509  if(src->hasServerPicoseconds)
7510  s += 2;
7511  return s;
7512 }
7513 
7514 static size_t
7515 DiagnosticInfo_calcSizeBinary(const UA_DiagnosticInfo *src, UA_DataType *_) {
7516  size_t s = 1; // encoding byte
7517  if(src->hasSymbolicId)
7518  s += 4;
7519  if(src->hasNamespaceUri)
7520  s += 4;
7521  if(src->hasLocalizedText)
7522  s += 4;
7523  if(src->hasLocale)
7524  s += 4;
7525  if(src->hasAdditionalInfo)
7526  s += String_calcSizeBinary(&src->additionalInfo, NULL);
7527  if(src->hasInnerStatusCode)
7528  s += 4;
7529  if(src->hasInnerDiagnosticInfo)
7530  s += DiagnosticInfo_calcSizeBinary(src->innerDiagnosticInfo, NULL);
7531  return s;
7532 }
7533 
7534 const UA_calcSizeBinarySignature calcSizeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
7535  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Boolean
7536  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Byte
7537  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize,
7538  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Int16
7539  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize,
7540  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Int32
7541  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize,
7542  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Int64
7543  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize,
7544  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Float
7545  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Double
7546  (UA_calcSizeBinarySignature)String_calcSizeBinary,
7547  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // DateTime
7548  (UA_calcSizeBinarySignature)Guid_calcSizeBinary,
7549  (UA_calcSizeBinarySignature)String_calcSizeBinary, // ByteString
7550  (UA_calcSizeBinarySignature)String_calcSizeBinary, // XmlElement
7551  (UA_calcSizeBinarySignature)NodeId_calcSizeBinary,
7552  (UA_calcSizeBinarySignature)ExpandedNodeId_calcSizeBinary,
7553  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // StatusCode
7555  (UA_calcSizeBinarySignature)LocalizedText_calcSizeBinary,
7556  (UA_calcSizeBinarySignature)ExtensionObject_calcSizeBinary,
7557  (UA_calcSizeBinarySignature)DataValue_calcSizeBinary,
7558  (UA_calcSizeBinarySignature)Variant_calcSizeBinary,
7559  (UA_calcSizeBinarySignature)DiagnosticInfo_calcSizeBinary,
7561 };
7562 
7563 size_t
7564 UA_calcSizeBinary(void *p, const UA_DataType *type) {
7565  size_t s = 0;
7566  uintptr_t ptr = (uintptr_t)p;
7567  u8 membersSize = type->membersSize;
7568  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
7569  for(size_t i = 0; i < membersSize; ++i) {
7570  const UA_DataTypeMember *member = &type->members[i];
7571  const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex];
7572  if(!member->isArray) {
7573  ptr += member->padding;
7574  size_t encode_index = membertype->builtin ? membertype->typeIndex : UA_BUILTIN_TYPES_COUNT;
7575  s += calcSizeBinaryJumpTable[encode_index]((const void*)ptr, membertype);
7576  ptr += membertype->memSize;
7577  } else {
7578  ptr += member->padding;
7579  const size_t length = *((const size_t*)ptr);
7580  ptr += sizeof(size_t);
7581  s += Array_calcSizeBinary(*(void *UA_RESTRICT const *)ptr, length, membertype);
7582  ptr += sizeof(void*);
7583  }
7584  }
7585  return s;
7586 }
7587 
7588 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_types_generated.c" ***********************************/
7589 
7590 /* Generated from Opc.Ua.Types.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
7591  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:07 */
7592 
7593 
7594 /* Boolean */
7595 static UA_DataTypeMember Boolean_members[1] = {
7597 #ifdef UA_ENABLE_TYPENAMES
7598  .memberName = "",
7599 #endif
7600  .namespaceZero = true,
7601  .padding = 0,
7602  .isArray = false
7603  },};
7604 
7605 /* SByte */
7606 static UA_DataTypeMember SByte_members[1] = {
7608 #ifdef UA_ENABLE_TYPENAMES
7609  .memberName = "",
7610 #endif
7611  .namespaceZero = true,
7612  .padding = 0,
7613  .isArray = false
7614  },};
7615 
7616 /* Byte */
7617 static UA_DataTypeMember Byte_members[1] = {
7619 #ifdef UA_ENABLE_TYPENAMES
7620  .memberName = "",
7621 #endif
7622  .namespaceZero = true,
7623  .padding = 0,
7624  .isArray = false
7625  },};
7626 
7627 /* Int16 */
7628 static UA_DataTypeMember Int16_members[1] = {
7630 #ifdef UA_ENABLE_TYPENAMES
7631  .memberName = "",
7632 #endif
7633  .namespaceZero = true,
7634  .padding = 0,
7635  .isArray = false
7636  },};
7637 
7638 /* UInt16 */
7639 static UA_DataTypeMember UInt16_members[1] = {
7641 #ifdef UA_ENABLE_TYPENAMES
7642  .memberName = "",
7643 #endif
7644  .namespaceZero = true,
7645  .padding = 0,
7646  .isArray = false
7647  },};
7648 
7649 /* Int32 */
7650 static UA_DataTypeMember Int32_members[1] = {
7652 #ifdef UA_ENABLE_TYPENAMES
7653  .memberName = "",
7654 #endif
7655  .namespaceZero = true,
7656  .padding = 0,
7657  .isArray = false
7658  },};
7659 
7660 /* UInt32 */
7661 static UA_DataTypeMember UInt32_members[1] = {
7663 #ifdef UA_ENABLE_TYPENAMES
7664  .memberName = "",
7665 #endif
7666  .namespaceZero = true,
7667  .padding = 0,
7668  .isArray = false
7669  },};
7670 
7671 /* Int64 */
7672 static UA_DataTypeMember Int64_members[1] = {
7674 #ifdef UA_ENABLE_TYPENAMES
7675  .memberName = "",
7676 #endif
7677  .namespaceZero = true,
7678  .padding = 0,
7679  .isArray = false
7680  },};
7681 
7682 /* UInt64 */
7683 static UA_DataTypeMember UInt64_members[1] = {
7685 #ifdef UA_ENABLE_TYPENAMES
7686  .memberName = "",
7687 #endif
7688  .namespaceZero = true,
7689  .padding = 0,
7690  .isArray = false
7691  },};
7692 
7693 /* Float */
7694 static UA_DataTypeMember Float_members[1] = {
7696 #ifdef UA_ENABLE_TYPENAMES
7697  .memberName = "",
7698 #endif
7699  .namespaceZero = true,
7700  .padding = 0,
7701  .isArray = false
7702  },};
7703 
7704 /* Double */
7705 static UA_DataTypeMember Double_members[1] = {
7707 #ifdef UA_ENABLE_TYPENAMES
7708  .memberName = "",
7709 #endif
7710  .namespaceZero = true,
7711  .padding = 0,
7712  .isArray = false
7713  },};
7714 
7715 /* String */
7716 static UA_DataTypeMember String_members[1] = {
7718 #ifdef UA_ENABLE_TYPENAMES
7719  .memberName = "",
7720 #endif
7721  .namespaceZero = true,
7722  .padding = 0,
7723  .isArray = true
7724  },};
7725 
7726 /* DateTime */
7727 static UA_DataTypeMember DateTime_members[1] = {
7729 #ifdef UA_ENABLE_TYPENAMES
7730  .memberName = "",
7731 #endif
7732  .namespaceZero = true,
7733  .padding = 0,
7734  .isArray = false
7735  },};
7736 
7737 /* Guid */
7738 static UA_DataTypeMember Guid_members[1] = {
7740 #ifdef UA_ENABLE_TYPENAMES
7741  .memberName = "",
7742 #endif
7743  .namespaceZero = true,
7744  .padding = 0,
7745  .isArray = false
7746  },};
7747 
7748 /* ByteString */
7749 static UA_DataTypeMember ByteString_members[1] = {
7751 #ifdef UA_ENABLE_TYPENAMES
7752  .memberName = "",
7753 #endif
7754  .namespaceZero = true,
7755  .padding = 0,
7756  .isArray = true
7757  },};
7758 
7759 /* XmlElement */
7760 static UA_DataTypeMember XmlElement_members[1] = {
7762 #ifdef UA_ENABLE_TYPENAMES
7763  .memberName = "",
7764 #endif
7765  .namespaceZero = true,
7766  .padding = 0,
7767  .isArray = true
7768  },};
7769 
7770 /* NodeId */
7771 static UA_DataTypeMember NodeId_members[1] = {
7773 #ifdef UA_ENABLE_TYPENAMES
7774  .memberName = "",
7775 #endif
7776  .namespaceZero = true,
7777  .padding = 0,
7778  .isArray = false
7779  },};
7780 
7781 /* ExpandedNodeId */
7782 static UA_DataTypeMember ExpandedNodeId_members[1] = {
7784 #ifdef UA_ENABLE_TYPENAMES
7785  .memberName = "",
7786 #endif
7787  .namespaceZero = true,
7788  .padding = 0,
7789  .isArray = false
7790  },};
7791 
7792 /* StatusCode */
7793 static UA_DataTypeMember StatusCode_members[1] = {
7795 #ifdef UA_ENABLE_TYPENAMES
7796  .memberName = "",
7797 #endif
7798  .namespaceZero = true,
7799  .padding = 0,
7800  .isArray = false
7801  },};
7802 
7803 /* QualifiedName */
7804 static UA_DataTypeMember QualifiedName_members[2] = {
7806 #ifdef UA_ENABLE_TYPENAMES
7807  .memberName = "namespaceIndex",
7808 #endif
7809  .namespaceZero = true,
7810  .padding = 0,
7811  .isArray = false
7812  },
7813  { .memberTypeIndex = UA_TYPES_STRING,
7814 #ifdef UA_ENABLE_TYPENAMES
7815  .memberName = "name",
7816 #endif
7817  .namespaceZero = true,
7818  .padding = offsetof(UA_QualifiedName, name) - offsetof(UA_QualifiedName, namespaceIndex) - sizeof(UA_Int16),
7819  .isArray = false
7820  },};
7821 
7822 /* LocalizedText */
7823 static UA_DataTypeMember LocalizedText_members[1] = {
7825 #ifdef UA_ENABLE_TYPENAMES
7826  .memberName = "",
7827 #endif
7828  .namespaceZero = true,
7829  .padding = 0,
7830  .isArray = false
7831  },};
7832 
7833 /* ExtensionObject */
7834 static UA_DataTypeMember ExtensionObject_members[1] = {
7836 #ifdef UA_ENABLE_TYPENAMES
7837  .memberName = "",
7838 #endif
7839  .namespaceZero = true,
7840  .padding = 0,
7841  .isArray = false
7842  },};
7843 
7844 /* DataValue */
7845 static UA_DataTypeMember DataValue_members[1] = {
7847 #ifdef UA_ENABLE_TYPENAMES
7848  .memberName = "",
7849 #endif
7850  .namespaceZero = true,
7851  .padding = 0,
7852  .isArray = false
7853  },};
7854 
7855 /* Variant */
7856 static UA_DataTypeMember Variant_members[1] = {
7858 #ifdef UA_ENABLE_TYPENAMES
7859  .memberName = "",
7860 #endif
7861  .namespaceZero = true,
7862  .padding = 0,
7863  .isArray = false
7864  },};
7865 
7866 /* DiagnosticInfo */
7867 static UA_DataTypeMember DiagnosticInfo_members[1] = {
7869 #ifdef UA_ENABLE_TYPENAMES
7870  .memberName = "",
7871 #endif
7872  .namespaceZero = true,
7873  .padding = 0,
7874  .isArray = false
7875  },};
7876 
7877 /* SignedSoftwareCertificate */
7878 static UA_DataTypeMember SignedSoftwareCertificate_members[2] = {
7880 #ifdef UA_ENABLE_TYPENAMES
7881  .memberName = "certificateData",
7882 #endif
7883  .namespaceZero = true,
7884  .padding = 0,
7885  .isArray = false
7886  },
7887  { .memberTypeIndex = UA_TYPES_BYTESTRING,
7888 #ifdef UA_ENABLE_TYPENAMES
7889  .memberName = "signature",
7890 #endif
7891  .namespaceZero = true,
7892  .padding = offsetof(UA_SignedSoftwareCertificate, signature) - offsetof(UA_SignedSoftwareCertificate, certificateData) - sizeof(UA_ByteString),
7893  .isArray = false
7894  },};
7895 
7896 /* BrowsePathTarget */
7897 static UA_DataTypeMember BrowsePathTarget_members[2] = {
7899 #ifdef UA_ENABLE_TYPENAMES
7900  .memberName = "targetId",
7901 #endif
7902  .namespaceZero = true,
7903  .padding = 0,
7904  .isArray = false
7905  },
7906  { .memberTypeIndex = UA_TYPES_UINT32,
7907 #ifdef UA_ENABLE_TYPENAMES
7908  .memberName = "remainingPathIndex",
7909 #endif
7910  .namespaceZero = true,
7911  .padding = offsetof(UA_BrowsePathTarget, remainingPathIndex) - offsetof(UA_BrowsePathTarget, targetId) - sizeof(UA_ExpandedNodeId),
7912  .isArray = false
7913  },};
7914 
7915 /* ViewAttributes */
7916 static UA_DataTypeMember ViewAttributes_members[7] = {
7918 #ifdef UA_ENABLE_TYPENAMES
7919  .memberName = "specifiedAttributes",
7920 #endif
7921  .namespaceZero = true,
7922  .padding = 0,
7923  .isArray = false
7924  },
7925  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
7926 #ifdef UA_ENABLE_TYPENAMES
7927  .memberName = "displayName",
7928 #endif
7929  .namespaceZero = true,
7930  .padding = offsetof(UA_ViewAttributes, displayName) - offsetof(UA_ViewAttributes, specifiedAttributes) - sizeof(UA_UInt32),
7931  .isArray = false
7932  },
7933  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
7934 #ifdef UA_ENABLE_TYPENAMES
7935  .memberName = "description",
7936 #endif
7937  .namespaceZero = true,
7938  .padding = offsetof(UA_ViewAttributes, description) - offsetof(UA_ViewAttributes, displayName) - sizeof(UA_LocalizedText),
7939  .isArray = false
7940  },
7941  { .memberTypeIndex = UA_TYPES_UINT32,
7942 #ifdef UA_ENABLE_TYPENAMES
7943  .memberName = "writeMask",
7944 #endif
7945  .namespaceZero = true,
7946  .padding = offsetof(UA_ViewAttributes, writeMask) - offsetof(UA_ViewAttributes, description) - sizeof(UA_LocalizedText),
7947  .isArray = false
7948  },
7949  { .memberTypeIndex = UA_TYPES_UINT32,
7950 #ifdef UA_ENABLE_TYPENAMES
7951  .memberName = "userWriteMask",
7952 #endif
7953  .namespaceZero = true,
7954  .padding = offsetof(UA_ViewAttributes, userWriteMask) - offsetof(UA_ViewAttributes, writeMask) - sizeof(UA_UInt32),
7955  .isArray = false
7956  },
7957  { .memberTypeIndex = UA_TYPES_BOOLEAN,
7958 #ifdef UA_ENABLE_TYPENAMES
7959  .memberName = "containsNoLoops",
7960 #endif
7961  .namespaceZero = true,
7962  .padding = offsetof(UA_ViewAttributes, containsNoLoops) - offsetof(UA_ViewAttributes, userWriteMask) - sizeof(UA_UInt32),
7963  .isArray = false
7964  },
7965  { .memberTypeIndex = UA_TYPES_BYTE,
7966 #ifdef UA_ENABLE_TYPENAMES
7967  .memberName = "eventNotifier",
7968 #endif
7969  .namespaceZero = true,
7970  .padding = offsetof(UA_ViewAttributes, eventNotifier) - offsetof(UA_ViewAttributes, containsNoLoops) - sizeof(UA_Boolean),
7971  .isArray = false
7972  },};
7973 
7974 /* BrowseResultMask */
7975 static UA_DataTypeMember BrowseResultMask_members[1] = {
7977 #ifdef UA_ENABLE_TYPENAMES
7978  .memberName = "",
7979 #endif
7980  .namespaceZero = true,
7981  .padding = 0,
7982  .isArray = false
7983  },};
7984 
7985 /* RequestHeader */
7986 static UA_DataTypeMember RequestHeader_members[7] = {
7988 #ifdef UA_ENABLE_TYPENAMES
7989  .memberName = "authenticationToken",
7990 #endif
7991  .namespaceZero = true,
7992  .padding = 0,
7993  .isArray = false
7994  },
7995  { .memberTypeIndex = UA_TYPES_DATETIME,
7996 #ifdef UA_ENABLE_TYPENAMES
7997  .memberName = "timestamp",
7998 #endif
7999  .namespaceZero = true,
8000  .padding = offsetof(UA_RequestHeader, timestamp) - offsetof(UA_RequestHeader, authenticationToken) - sizeof(UA_NodeId),
8001  .isArray = false
8002  },
8003  { .memberTypeIndex = UA_TYPES_UINT32,
8004 #ifdef UA_ENABLE_TYPENAMES
8005  .memberName = "requestHandle",
8006 #endif
8007  .namespaceZero = true,
8008  .padding = offsetof(UA_RequestHeader, requestHandle) - offsetof(UA_RequestHeader, timestamp) - sizeof(UA_DateTime),
8009  .isArray = false
8010  },
8011  { .memberTypeIndex = UA_TYPES_UINT32,
8012 #ifdef UA_ENABLE_TYPENAMES
8013  .memberName = "returnDiagnostics",
8014 #endif
8015  .namespaceZero = true,
8016  .padding = offsetof(UA_RequestHeader, returnDiagnostics) - offsetof(UA_RequestHeader, requestHandle) - sizeof(UA_UInt32),
8017  .isArray = false
8018  },
8019  { .memberTypeIndex = UA_TYPES_STRING,
8020 #ifdef UA_ENABLE_TYPENAMES
8021  .memberName = "auditEntryId",
8022 #endif
8023  .namespaceZero = true,
8024  .padding = offsetof(UA_RequestHeader, auditEntryId) - offsetof(UA_RequestHeader, returnDiagnostics) - sizeof(UA_UInt32),
8025  .isArray = false
8026  },
8027  { .memberTypeIndex = UA_TYPES_UINT32,
8028 #ifdef UA_ENABLE_TYPENAMES
8029  .memberName = "timeoutHint",
8030 #endif
8031  .namespaceZero = true,
8032  .padding = offsetof(UA_RequestHeader, timeoutHint) - offsetof(UA_RequestHeader, auditEntryId) - sizeof(UA_String),
8033  .isArray = false
8034  },
8035  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8036 #ifdef UA_ENABLE_TYPENAMES
8037  .memberName = "additionalHeader",
8038 #endif
8039  .namespaceZero = true,
8040  .padding = offsetof(UA_RequestHeader, additionalHeader) - offsetof(UA_RequestHeader, timeoutHint) - sizeof(UA_UInt32),
8041  .isArray = false
8042  },};
8043 
8044 /* MonitoredItemModifyResult */
8045 static UA_DataTypeMember MonitoredItemModifyResult_members[4] = {
8047 #ifdef UA_ENABLE_TYPENAMES
8048  .memberName = "statusCode",
8049 #endif
8050  .namespaceZero = true,
8051  .padding = 0,
8052  .isArray = false
8053  },
8054  { .memberTypeIndex = UA_TYPES_DOUBLE,
8055 #ifdef UA_ENABLE_TYPENAMES
8056  .memberName = "revisedSamplingInterval",
8057 #endif
8058  .namespaceZero = true,
8059  .padding = offsetof(UA_MonitoredItemModifyResult, revisedSamplingInterval) - offsetof(UA_MonitoredItemModifyResult, statusCode) - sizeof(UA_StatusCode),
8060  .isArray = false
8061  },
8062  { .memberTypeIndex = UA_TYPES_UINT32,
8063 #ifdef UA_ENABLE_TYPENAMES
8064  .memberName = "revisedQueueSize",
8065 #endif
8066  .namespaceZero = true,
8067  .padding = offsetof(UA_MonitoredItemModifyResult, revisedQueueSize) - offsetof(UA_MonitoredItemModifyResult, revisedSamplingInterval) - sizeof(UA_Double),
8068  .isArray = false
8069  },
8070  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8071 #ifdef UA_ENABLE_TYPENAMES
8072  .memberName = "filterResult",
8073 #endif
8074  .namespaceZero = true,
8075  .padding = offsetof(UA_MonitoredItemModifyResult, filterResult) - offsetof(UA_MonitoredItemModifyResult, revisedQueueSize) - sizeof(UA_UInt32),
8076  .isArray = false
8077  },};
8078 
8079 /* CloseSecureChannelRequest */
8080 static UA_DataTypeMember CloseSecureChannelRequest_members[1] = {
8082 #ifdef UA_ENABLE_TYPENAMES
8083  .memberName = "requestHeader",
8084 #endif
8085  .namespaceZero = true,
8086  .padding = 0,
8087  .isArray = false
8088  },};
8089 
8090 /* AddNodesResult */
8091 static UA_DataTypeMember AddNodesResult_members[2] = {
8093 #ifdef UA_ENABLE_TYPENAMES
8094  .memberName = "statusCode",
8095 #endif
8096  .namespaceZero = true,
8097  .padding = 0,
8098  .isArray = false
8099  },
8100  { .memberTypeIndex = UA_TYPES_NODEID,
8101 #ifdef UA_ENABLE_TYPENAMES
8102  .memberName = "addedNodeId",
8103 #endif
8104  .namespaceZero = true,
8105  .padding = offsetof(UA_AddNodesResult, addedNodeId) - offsetof(UA_AddNodesResult, statusCode) - sizeof(UA_StatusCode),
8106  .isArray = false
8107  },};
8108 
8109 /* VariableAttributes */
8110 static UA_DataTypeMember VariableAttributes_members[13] = {
8112 #ifdef UA_ENABLE_TYPENAMES
8113  .memberName = "specifiedAttributes",
8114 #endif
8115  .namespaceZero = true,
8116  .padding = 0,
8117  .isArray = false
8118  },
8119  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8120 #ifdef UA_ENABLE_TYPENAMES
8121  .memberName = "displayName",
8122 #endif
8123  .namespaceZero = true,
8124  .padding = offsetof(UA_VariableAttributes, displayName) - offsetof(UA_VariableAttributes, specifiedAttributes) - sizeof(UA_UInt32),
8125  .isArray = false
8126  },
8127  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8128 #ifdef UA_ENABLE_TYPENAMES
8129  .memberName = "description",
8130 #endif
8131  .namespaceZero = true,
8132  .padding = offsetof(UA_VariableAttributes, description) - offsetof(UA_VariableAttributes, displayName) - sizeof(UA_LocalizedText),
8133  .isArray = false
8134  },
8135  { .memberTypeIndex = UA_TYPES_UINT32,
8136 #ifdef UA_ENABLE_TYPENAMES
8137  .memberName = "writeMask",
8138 #endif
8139  .namespaceZero = true,
8140  .padding = offsetof(UA_VariableAttributes, writeMask) - offsetof(UA_VariableAttributes, description) - sizeof(UA_LocalizedText),
8141  .isArray = false
8142  },
8143  { .memberTypeIndex = UA_TYPES_UINT32,
8144 #ifdef UA_ENABLE_TYPENAMES
8145  .memberName = "userWriteMask",
8146 #endif
8147  .namespaceZero = true,
8148  .padding = offsetof(UA_VariableAttributes, userWriteMask) - offsetof(UA_VariableAttributes, writeMask) - sizeof(UA_UInt32),
8149  .isArray = false
8150  },
8151  { .memberTypeIndex = UA_TYPES_VARIANT,
8152 #ifdef UA_ENABLE_TYPENAMES
8153  .memberName = "value",
8154 #endif
8155  .namespaceZero = true,
8156  .padding = offsetof(UA_VariableAttributes, value) - offsetof(UA_VariableAttributes, userWriteMask) - sizeof(UA_UInt32),
8157  .isArray = false
8158  },
8159  { .memberTypeIndex = UA_TYPES_NODEID,
8160 #ifdef UA_ENABLE_TYPENAMES
8161  .memberName = "dataType",
8162 #endif
8163  .namespaceZero = true,
8164  .padding = offsetof(UA_VariableAttributes, dataType) - offsetof(UA_VariableAttributes, value) - sizeof(UA_Variant),
8165  .isArray = false
8166  },
8167  { .memberTypeIndex = UA_TYPES_INT32,
8168 #ifdef UA_ENABLE_TYPENAMES
8169  .memberName = "valueRank",
8170 #endif
8171  .namespaceZero = true,
8172  .padding = offsetof(UA_VariableAttributes, valueRank) - offsetof(UA_VariableAttributes, dataType) - sizeof(UA_NodeId),
8173  .isArray = false
8174  },
8175  { .memberTypeIndex = UA_TYPES_UINT32,
8176 #ifdef UA_ENABLE_TYPENAMES
8177  .memberName = "arrayDimensions",
8178 #endif
8179  .namespaceZero = true,
8180  .padding = offsetof(UA_VariableAttributes, arrayDimensionsSize) - offsetof(UA_VariableAttributes, valueRank) - sizeof(UA_Int32),
8181  .isArray = true
8182  },
8183  { .memberTypeIndex = UA_TYPES_BYTE,
8184 #ifdef UA_ENABLE_TYPENAMES
8185  .memberName = "accessLevel",
8186 #endif
8187  .namespaceZero = true,
8188  .padding = offsetof(UA_VariableAttributes, accessLevel) - offsetof(UA_VariableAttributes, arrayDimensions) - sizeof(void*),
8189  .isArray = false
8190  },
8191  { .memberTypeIndex = UA_TYPES_BYTE,
8192 #ifdef UA_ENABLE_TYPENAMES
8193  .memberName = "userAccessLevel",
8194 #endif
8195  .namespaceZero = true,
8196  .padding = offsetof(UA_VariableAttributes, userAccessLevel) - offsetof(UA_VariableAttributes, accessLevel) - sizeof(UA_Byte),
8197  .isArray = false
8198  },
8199  { .memberTypeIndex = UA_TYPES_DOUBLE,
8200 #ifdef UA_ENABLE_TYPENAMES
8201  .memberName = "minimumSamplingInterval",
8202 #endif
8203  .namespaceZero = true,
8204  .padding = offsetof(UA_VariableAttributes, minimumSamplingInterval) - offsetof(UA_VariableAttributes, userAccessLevel) - sizeof(UA_Byte),
8205  .isArray = false
8206  },
8207  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8208 #ifdef UA_ENABLE_TYPENAMES
8209  .memberName = "historizing",
8210 #endif
8211  .namespaceZero = true,
8212  .padding = offsetof(UA_VariableAttributes, historizing) - offsetof(UA_VariableAttributes, minimumSamplingInterval) - sizeof(UA_Double),
8213  .isArray = false
8214  },};
8215 
8216 /* NotificationMessage */
8217 static UA_DataTypeMember NotificationMessage_members[3] = {
8219 #ifdef UA_ENABLE_TYPENAMES
8220  .memberName = "sequenceNumber",
8221 #endif
8222  .namespaceZero = true,
8223  .padding = 0,
8224  .isArray = false
8225  },
8226  { .memberTypeIndex = UA_TYPES_DATETIME,
8227 #ifdef UA_ENABLE_TYPENAMES
8228  .memberName = "publishTime",
8229 #endif
8230  .namespaceZero = true,
8231  .padding = offsetof(UA_NotificationMessage, publishTime) - offsetof(UA_NotificationMessage, sequenceNumber) - sizeof(UA_UInt32),
8232  .isArray = false
8233  },
8234  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8235 #ifdef UA_ENABLE_TYPENAMES
8236  .memberName = "notificationData",
8237 #endif
8238  .namespaceZero = true,
8239  .padding = offsetof(UA_NotificationMessage, notificationDataSize) - offsetof(UA_NotificationMessage, publishTime) - sizeof(UA_DateTime),
8240  .isArray = true
8241  },};
8242 
8243 /* NodeAttributesMask */
8244 static UA_DataTypeMember NodeAttributesMask_members[1] = {
8246 #ifdef UA_ENABLE_TYPENAMES
8247  .memberName = "",
8248 #endif
8249  .namespaceZero = true,
8250  .padding = 0,
8251  .isArray = false
8252  },};
8253 
8254 /* MonitoringMode */
8255 static UA_DataTypeMember MonitoringMode_members[1] = {
8257 #ifdef UA_ENABLE_TYPENAMES
8258  .memberName = "",
8259 #endif
8260  .namespaceZero = true,
8261  .padding = 0,
8262  .isArray = false
8263  },};
8264 
8265 /* CallMethodResult */
8266 static UA_DataTypeMember CallMethodResult_members[4] = {
8268 #ifdef UA_ENABLE_TYPENAMES
8269  .memberName = "statusCode",
8270 #endif
8271  .namespaceZero = true,
8272  .padding = 0,
8273  .isArray = false
8274  },
8275  { .memberTypeIndex = UA_TYPES_STATUSCODE,
8276 #ifdef UA_ENABLE_TYPENAMES
8277  .memberName = "inputArgumentResults",
8278 #endif
8279  .namespaceZero = true,
8280  .padding = offsetof(UA_CallMethodResult, inputArgumentResultsSize) - offsetof(UA_CallMethodResult, statusCode) - sizeof(UA_StatusCode),
8281  .isArray = true
8282  },
8283  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
8284 #ifdef UA_ENABLE_TYPENAMES
8285  .memberName = "inputArgumentDiagnosticInfos",
8286 #endif
8287  .namespaceZero = true,
8288  .padding = offsetof(UA_CallMethodResult, inputArgumentDiagnosticInfosSize) - offsetof(UA_CallMethodResult, inputArgumentResults) - sizeof(void*),
8289  .isArray = true
8290  },
8291  { .memberTypeIndex = UA_TYPES_VARIANT,
8292 #ifdef UA_ENABLE_TYPENAMES
8293  .memberName = "outputArguments",
8294 #endif
8295  .namespaceZero = true,
8296  .padding = offsetof(UA_CallMethodResult, outputArgumentsSize) - offsetof(UA_CallMethodResult, inputArgumentDiagnosticInfos) - sizeof(void*),
8297  .isArray = true
8298  },};
8299 
8300 /* ParsingResult */
8301 static UA_DataTypeMember ParsingResult_members[3] = {
8303 #ifdef UA_ENABLE_TYPENAMES
8304  .memberName = "statusCode",
8305 #endif
8306  .namespaceZero = true,
8307  .padding = 0,
8308  .isArray = false
8309  },
8310  { .memberTypeIndex = UA_TYPES_STATUSCODE,
8311 #ifdef UA_ENABLE_TYPENAMES
8312  .memberName = "dataStatusCodes",
8313 #endif
8314  .namespaceZero = true,
8315  .padding = offsetof(UA_ParsingResult, dataStatusCodesSize) - offsetof(UA_ParsingResult, statusCode) - sizeof(UA_StatusCode),
8316  .isArray = true
8317  },
8318  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
8319 #ifdef UA_ENABLE_TYPENAMES
8320  .memberName = "dataDiagnosticInfos",
8321 #endif
8322  .namespaceZero = true,
8323  .padding = offsetof(UA_ParsingResult, dataDiagnosticInfosSize) - offsetof(UA_ParsingResult, dataStatusCodes) - sizeof(void*),
8324  .isArray = true
8325  },};
8326 
8327 /* RelativePathElement */
8328 static UA_DataTypeMember RelativePathElement_members[4] = {
8330 #ifdef UA_ENABLE_TYPENAMES
8331  .memberName = "referenceTypeId",
8332 #endif
8333  .namespaceZero = true,
8334  .padding = 0,
8335  .isArray = false
8336  },
8337  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8338 #ifdef UA_ENABLE_TYPENAMES
8339  .memberName = "isInverse",
8340 #endif
8341  .namespaceZero = true,
8342  .padding = offsetof(UA_RelativePathElement, isInverse) - offsetof(UA_RelativePathElement, referenceTypeId) - sizeof(UA_NodeId),
8343  .isArray = false
8344  },
8345  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8346 #ifdef UA_ENABLE_TYPENAMES
8347  .memberName = "includeSubtypes",
8348 #endif
8349  .namespaceZero = true,
8350  .padding = offsetof(UA_RelativePathElement, includeSubtypes) - offsetof(UA_RelativePathElement, isInverse) - sizeof(UA_Boolean),
8351  .isArray = false
8352  },
8353  { .memberTypeIndex = UA_TYPES_QUALIFIEDNAME,
8354 #ifdef UA_ENABLE_TYPENAMES
8355  .memberName = "targetName",
8356 #endif
8357  .namespaceZero = true,
8358  .padding = offsetof(UA_RelativePathElement, targetName) - offsetof(UA_RelativePathElement, includeSubtypes) - sizeof(UA_Boolean),
8359  .isArray = false
8360  },};
8361 
8362 /* BrowseDirection */
8363 static UA_DataTypeMember BrowseDirection_members[1] = {
8365 #ifdef UA_ENABLE_TYPENAMES
8366  .memberName = "",
8367 #endif
8368  .namespaceZero = true,
8369  .padding = 0,
8370  .isArray = false
8371  },};
8372 
8373 /* CallMethodRequest */
8374 static UA_DataTypeMember CallMethodRequest_members[3] = {
8376 #ifdef UA_ENABLE_TYPENAMES
8377  .memberName = "objectId",
8378 #endif
8379  .namespaceZero = true,
8380  .padding = 0,
8381  .isArray = false
8382  },
8383  { .memberTypeIndex = UA_TYPES_NODEID,
8384 #ifdef UA_ENABLE_TYPENAMES
8385  .memberName = "methodId",
8386 #endif
8387  .namespaceZero = true,
8388  .padding = offsetof(UA_CallMethodRequest, methodId) - offsetof(UA_CallMethodRequest, objectId) - sizeof(UA_NodeId),
8389  .isArray = false
8390  },
8391  { .memberTypeIndex = UA_TYPES_VARIANT,
8392 #ifdef UA_ENABLE_TYPENAMES
8393  .memberName = "inputArguments",
8394 #endif
8395  .namespaceZero = true,
8396  .padding = offsetof(UA_CallMethodRequest, inputArgumentsSize) - offsetof(UA_CallMethodRequest, methodId) - sizeof(UA_NodeId),
8397  .isArray = true
8398  },};
8399 
8400 /* UnregisterNodesRequest */
8401 static UA_DataTypeMember UnregisterNodesRequest_members[2] = {
8403 #ifdef UA_ENABLE_TYPENAMES
8404  .memberName = "requestHeader",
8405 #endif
8406  .namespaceZero = true,
8407  .padding = 0,
8408  .isArray = false
8409  },
8410  { .memberTypeIndex = UA_TYPES_NODEID,
8411 #ifdef UA_ENABLE_TYPENAMES
8412  .memberName = "nodesToUnregister",
8413 #endif
8414  .namespaceZero = true,
8415  .padding = offsetof(UA_UnregisterNodesRequest, nodesToUnregisterSize) - offsetof(UA_UnregisterNodesRequest, requestHeader) - sizeof(UA_RequestHeader),
8416  .isArray = true
8417  },};
8418 
8419 /* ContentFilterElementResult */
8420 static UA_DataTypeMember ContentFilterElementResult_members[3] = {
8422 #ifdef UA_ENABLE_TYPENAMES
8423  .memberName = "statusCode",
8424 #endif
8425  .namespaceZero = true,
8426  .padding = 0,
8427  .isArray = false
8428  },
8429  { .memberTypeIndex = UA_TYPES_STATUSCODE,
8430 #ifdef UA_ENABLE_TYPENAMES
8431  .memberName = "operandStatusCodes",
8432 #endif
8433  .namespaceZero = true,
8434  .padding = offsetof(UA_ContentFilterElementResult, operandStatusCodesSize) - offsetof(UA_ContentFilterElementResult, statusCode) - sizeof(UA_StatusCode),
8435  .isArray = true
8436  },
8437  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
8438 #ifdef UA_ENABLE_TYPENAMES
8439  .memberName = "operandDiagnosticInfos",
8440 #endif
8441  .namespaceZero = true,
8442  .padding = offsetof(UA_ContentFilterElementResult, operandDiagnosticInfosSize) - offsetof(UA_ContentFilterElementResult, operandStatusCodes) - sizeof(void*),
8443  .isArray = true
8444  },};
8445 
8446 /* QueryDataSet */
8447 static UA_DataTypeMember QueryDataSet_members[3] = {
8449 #ifdef UA_ENABLE_TYPENAMES
8450  .memberName = "nodeId",
8451 #endif
8452  .namespaceZero = true,
8453  .padding = 0,
8454  .isArray = false
8455  },
8456  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
8457 #ifdef UA_ENABLE_TYPENAMES
8458  .memberName = "typeDefinitionNode",
8459 #endif
8460  .namespaceZero = true,
8461  .padding = offsetof(UA_QueryDataSet, typeDefinitionNode) - offsetof(UA_QueryDataSet, nodeId) - sizeof(UA_ExpandedNodeId),
8462  .isArray = false
8463  },
8464  { .memberTypeIndex = UA_TYPES_VARIANT,
8465 #ifdef UA_ENABLE_TYPENAMES
8466  .memberName = "values",
8467 #endif
8468  .namespaceZero = true,
8469  .padding = offsetof(UA_QueryDataSet, valuesSize) - offsetof(UA_QueryDataSet, typeDefinitionNode) - sizeof(UA_ExpandedNodeId),
8470  .isArray = true
8471  },};
8472 
8473 /* AnonymousIdentityToken */
8474 static UA_DataTypeMember AnonymousIdentityToken_members[1] = {
8476 #ifdef UA_ENABLE_TYPENAMES
8477  .memberName = "policyId",
8478 #endif
8479  .namespaceZero = true,
8480  .padding = 0,
8481  .isArray = false
8482  },};
8483 
8484 /* SetPublishingModeRequest */
8485 static UA_DataTypeMember SetPublishingModeRequest_members[3] = {
8487 #ifdef UA_ENABLE_TYPENAMES
8488  .memberName = "requestHeader",
8489 #endif
8490  .namespaceZero = true,
8491  .padding = 0,
8492  .isArray = false
8493  },
8494  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8495 #ifdef UA_ENABLE_TYPENAMES
8496  .memberName = "publishingEnabled",
8497 #endif
8498  .namespaceZero = true,
8499  .padding = offsetof(UA_SetPublishingModeRequest, publishingEnabled) - offsetof(UA_SetPublishingModeRequest, requestHeader) - sizeof(UA_RequestHeader),
8500  .isArray = false
8501  },
8502  { .memberTypeIndex = UA_TYPES_UINT32,
8503 #ifdef UA_ENABLE_TYPENAMES
8504  .memberName = "subscriptionIds",
8505 #endif
8506  .namespaceZero = true,
8507  .padding = offsetof(UA_SetPublishingModeRequest, subscriptionIdsSize) - offsetof(UA_SetPublishingModeRequest, publishingEnabled) - sizeof(UA_Boolean),
8508  .isArray = true
8509  },};
8510 
8511 /* TimestampsToReturn */
8512 static UA_DataTypeMember TimestampsToReturn_members[1] = {
8514 #ifdef UA_ENABLE_TYPENAMES
8515  .memberName = "",
8516 #endif
8517  .namespaceZero = true,
8518  .padding = 0,
8519  .isArray = false
8520  },};
8521 
8522 /* CallRequest */
8523 static UA_DataTypeMember CallRequest_members[2] = {
8525 #ifdef UA_ENABLE_TYPENAMES
8526  .memberName = "requestHeader",
8527 #endif
8528  .namespaceZero = true,
8529  .padding = 0,
8530  .isArray = false
8531  },
8532  { .memberTypeIndex = UA_TYPES_CALLMETHODREQUEST,
8533 #ifdef UA_ENABLE_TYPENAMES
8534  .memberName = "methodsToCall",
8535 #endif
8536  .namespaceZero = true,
8537  .padding = offsetof(UA_CallRequest, methodsToCallSize) - offsetof(UA_CallRequest, requestHeader) - sizeof(UA_RequestHeader),
8538  .isArray = true
8539  },};
8540 
8541 /* MethodAttributes */
8542 static UA_DataTypeMember MethodAttributes_members[7] = {
8544 #ifdef UA_ENABLE_TYPENAMES
8545  .memberName = "specifiedAttributes",
8546 #endif
8547  .namespaceZero = true,
8548  .padding = 0,
8549  .isArray = false
8550  },
8551  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8552 #ifdef UA_ENABLE_TYPENAMES
8553  .memberName = "displayName",
8554 #endif
8555  .namespaceZero = true,
8556  .padding = offsetof(UA_MethodAttributes, displayName) - offsetof(UA_MethodAttributes, specifiedAttributes) - sizeof(UA_UInt32),
8557  .isArray = false
8558  },
8559  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8560 #ifdef UA_ENABLE_TYPENAMES
8561  .memberName = "description",
8562 #endif
8563  .namespaceZero = true,
8564  .padding = offsetof(UA_MethodAttributes, description) - offsetof(UA_MethodAttributes, displayName) - sizeof(UA_LocalizedText),
8565  .isArray = false
8566  },
8567  { .memberTypeIndex = UA_TYPES_UINT32,
8568 #ifdef UA_ENABLE_TYPENAMES
8569  .memberName = "writeMask",
8570 #endif
8571  .namespaceZero = true,
8572  .padding = offsetof(UA_MethodAttributes, writeMask) - offsetof(UA_MethodAttributes, description) - sizeof(UA_LocalizedText),
8573  .isArray = false
8574  },
8575  { .memberTypeIndex = UA_TYPES_UINT32,
8576 #ifdef UA_ENABLE_TYPENAMES
8577  .memberName = "userWriteMask",
8578 #endif
8579  .namespaceZero = true,
8580  .padding = offsetof(UA_MethodAttributes, userWriteMask) - offsetof(UA_MethodAttributes, writeMask) - sizeof(UA_UInt32),
8581  .isArray = false
8582  },
8583  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8584 #ifdef UA_ENABLE_TYPENAMES
8585  .memberName = "executable",
8586 #endif
8587  .namespaceZero = true,
8588  .padding = offsetof(UA_MethodAttributes, executable) - offsetof(UA_MethodAttributes, userWriteMask) - sizeof(UA_UInt32),
8589  .isArray = false
8590  },
8591  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8592 #ifdef UA_ENABLE_TYPENAMES
8593  .memberName = "userExecutable",
8594 #endif
8595  .namespaceZero = true,
8596  .padding = offsetof(UA_MethodAttributes, userExecutable) - offsetof(UA_MethodAttributes, executable) - sizeof(UA_Boolean),
8597  .isArray = false
8598  },};
8599 
8600 /* DeleteReferencesItem */
8601 static UA_DataTypeMember DeleteReferencesItem_members[5] = {
8603 #ifdef UA_ENABLE_TYPENAMES
8604  .memberName = "sourceNodeId",
8605 #endif
8606  .namespaceZero = true,
8607  .padding = 0,
8608  .isArray = false
8609  },
8610  { .memberTypeIndex = UA_TYPES_NODEID,
8611 #ifdef UA_ENABLE_TYPENAMES
8612  .memberName = "referenceTypeId",
8613 #endif
8614  .namespaceZero = true,
8615  .padding = offsetof(UA_DeleteReferencesItem, referenceTypeId) - offsetof(UA_DeleteReferencesItem, sourceNodeId) - sizeof(UA_NodeId),
8616  .isArray = false
8617  },
8618  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8619 #ifdef UA_ENABLE_TYPENAMES
8620  .memberName = "isForward",
8621 #endif
8622  .namespaceZero = true,
8623  .padding = offsetof(UA_DeleteReferencesItem, isForward) - offsetof(UA_DeleteReferencesItem, referenceTypeId) - sizeof(UA_NodeId),
8624  .isArray = false
8625  },
8626  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
8627 #ifdef UA_ENABLE_TYPENAMES
8628  .memberName = "targetNodeId",
8629 #endif
8630  .namespaceZero = true,
8631  .padding = offsetof(UA_DeleteReferencesItem, targetNodeId) - offsetof(UA_DeleteReferencesItem, isForward) - sizeof(UA_Boolean),
8632  .isArray = false
8633  },
8634  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8635 #ifdef UA_ENABLE_TYPENAMES
8636  .memberName = "deleteBidirectional",
8637 #endif
8638  .namespaceZero = true,
8639  .padding = offsetof(UA_DeleteReferencesItem, deleteBidirectional) - offsetof(UA_DeleteReferencesItem, targetNodeId) - sizeof(UA_ExpandedNodeId),
8640  .isArray = false
8641  },};
8642 
8643 /* WriteValue */
8644 static UA_DataTypeMember WriteValue_members[4] = {
8646 #ifdef UA_ENABLE_TYPENAMES
8647  .memberName = "nodeId",
8648 #endif
8649  .namespaceZero = true,
8650  .padding = 0,
8651  .isArray = false
8652  },
8653  { .memberTypeIndex = UA_TYPES_UINT32,
8654 #ifdef UA_ENABLE_TYPENAMES
8655  .memberName = "attributeId",
8656 #endif
8657  .namespaceZero = true,
8658  .padding = offsetof(UA_WriteValue, attributeId) - offsetof(UA_WriteValue, nodeId) - sizeof(UA_NodeId),
8659  .isArray = false
8660  },
8661  { .memberTypeIndex = UA_TYPES_STRING,
8662 #ifdef UA_ENABLE_TYPENAMES
8663  .memberName = "indexRange",
8664 #endif
8665  .namespaceZero = true,
8666  .padding = offsetof(UA_WriteValue, indexRange) - offsetof(UA_WriteValue, attributeId) - sizeof(UA_UInt32),
8667  .isArray = false
8668  },
8669  { .memberTypeIndex = UA_TYPES_DATAVALUE,
8670 #ifdef UA_ENABLE_TYPENAMES
8671  .memberName = "value",
8672 #endif
8673  .namespaceZero = true,
8674  .padding = offsetof(UA_WriteValue, value) - offsetof(UA_WriteValue, indexRange) - sizeof(UA_String),
8675  .isArray = false
8676  },};
8677 
8678 /* MonitoredItemCreateResult */
8679 static UA_DataTypeMember MonitoredItemCreateResult_members[5] = {
8681 #ifdef UA_ENABLE_TYPENAMES
8682  .memberName = "statusCode",
8683 #endif
8684  .namespaceZero = true,
8685  .padding = 0,
8686  .isArray = false
8687  },
8688  { .memberTypeIndex = UA_TYPES_UINT32,
8689 #ifdef UA_ENABLE_TYPENAMES
8690  .memberName = "monitoredItemId",
8691 #endif
8692  .namespaceZero = true,
8693  .padding = offsetof(UA_MonitoredItemCreateResult, monitoredItemId) - offsetof(UA_MonitoredItemCreateResult, statusCode) - sizeof(UA_StatusCode),
8694  .isArray = false
8695  },
8696  { .memberTypeIndex = UA_TYPES_DOUBLE,
8697 #ifdef UA_ENABLE_TYPENAMES
8698  .memberName = "revisedSamplingInterval",
8699 #endif
8700  .namespaceZero = true,
8701  .padding = offsetof(UA_MonitoredItemCreateResult, revisedSamplingInterval) - offsetof(UA_MonitoredItemCreateResult, monitoredItemId) - sizeof(UA_UInt32),
8702  .isArray = false
8703  },
8704  { .memberTypeIndex = UA_TYPES_UINT32,
8705 #ifdef UA_ENABLE_TYPENAMES
8706  .memberName = "revisedQueueSize",
8707 #endif
8708  .namespaceZero = true,
8709  .padding = offsetof(UA_MonitoredItemCreateResult, revisedQueueSize) - offsetof(UA_MonitoredItemCreateResult, revisedSamplingInterval) - sizeof(UA_Double),
8710  .isArray = false
8711  },
8712  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8713 #ifdef UA_ENABLE_TYPENAMES
8714  .memberName = "filterResult",
8715 #endif
8716  .namespaceZero = true,
8717  .padding = offsetof(UA_MonitoredItemCreateResult, filterResult) - offsetof(UA_MonitoredItemCreateResult, revisedQueueSize) - sizeof(UA_UInt32),
8718  .isArray = false
8719  },};
8720 
8721 /* MessageSecurityMode */
8722 static UA_DataTypeMember MessageSecurityMode_members[1] = {
8724 #ifdef UA_ENABLE_TYPENAMES
8725  .memberName = "",
8726 #endif
8727  .namespaceZero = true,
8728  .padding = 0,
8729  .isArray = false
8730  },};
8731 
8732 /* MonitoringParameters */
8733 static UA_DataTypeMember MonitoringParameters_members[5] = {
8735 #ifdef UA_ENABLE_TYPENAMES
8736  .memberName = "clientHandle",
8737 #endif
8738  .namespaceZero = true,
8739  .padding = 0,
8740  .isArray = false
8741  },
8742  { .memberTypeIndex = UA_TYPES_DOUBLE,
8743 #ifdef UA_ENABLE_TYPENAMES
8744  .memberName = "samplingInterval",
8745 #endif
8746  .namespaceZero = true,
8747  .padding = offsetof(UA_MonitoringParameters, samplingInterval) - offsetof(UA_MonitoringParameters, clientHandle) - sizeof(UA_UInt32),
8748  .isArray = false
8749  },
8750  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8751 #ifdef UA_ENABLE_TYPENAMES
8752  .memberName = "filter",
8753 #endif
8754  .namespaceZero = true,
8755  .padding = offsetof(UA_MonitoringParameters, filter) - offsetof(UA_MonitoringParameters, samplingInterval) - sizeof(UA_Double),
8756  .isArray = false
8757  },
8758  { .memberTypeIndex = UA_TYPES_UINT32,
8759 #ifdef UA_ENABLE_TYPENAMES
8760  .memberName = "queueSize",
8761 #endif
8762  .namespaceZero = true,
8763  .padding = offsetof(UA_MonitoringParameters, queueSize) - offsetof(UA_MonitoringParameters, filter) - sizeof(UA_ExtensionObject),
8764  .isArray = false
8765  },
8766  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8767 #ifdef UA_ENABLE_TYPENAMES
8768  .memberName = "discardOldest",
8769 #endif
8770  .namespaceZero = true,
8771  .padding = offsetof(UA_MonitoringParameters, discardOldest) - offsetof(UA_MonitoringParameters, queueSize) - sizeof(UA_UInt32),
8772  .isArray = false
8773  },};
8774 
8775 /* SignatureData */
8776 static UA_DataTypeMember SignatureData_members[2] = {
8778 #ifdef UA_ENABLE_TYPENAMES
8779  .memberName = "algorithm",
8780 #endif
8781  .namespaceZero = true,
8782  .padding = 0,
8783  .isArray = false
8784  },
8785  { .memberTypeIndex = UA_TYPES_BYTESTRING,
8786 #ifdef UA_ENABLE_TYPENAMES
8787  .memberName = "signature",
8788 #endif
8789  .namespaceZero = true,
8790  .padding = offsetof(UA_SignatureData, signature) - offsetof(UA_SignatureData, algorithm) - sizeof(UA_String),
8791  .isArray = false
8792  },};
8793 
8794 /* ReferenceNode */
8795 static UA_DataTypeMember ReferenceNode_members[3] = {
8797 #ifdef UA_ENABLE_TYPENAMES
8798  .memberName = "referenceTypeId",
8799 #endif
8800  .namespaceZero = true,
8801  .padding = 0,
8802  .isArray = false
8803  },
8804  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8805 #ifdef UA_ENABLE_TYPENAMES
8806  .memberName = "isInverse",
8807 #endif
8808  .namespaceZero = true,
8809  .padding = offsetof(UA_ReferenceNode, isInverse) - offsetof(UA_ReferenceNode, referenceTypeId) - sizeof(UA_NodeId),
8810  .isArray = false
8811  },
8812  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
8813 #ifdef UA_ENABLE_TYPENAMES
8814  .memberName = "targetId",
8815 #endif
8816  .namespaceZero = true,
8817  .padding = offsetof(UA_ReferenceNode, targetId) - offsetof(UA_ReferenceNode, isInverse) - sizeof(UA_Boolean),
8818  .isArray = false
8819  },};
8820 
8821 /* Argument */
8822 static UA_DataTypeMember Argument_members[5] = {
8824 #ifdef UA_ENABLE_TYPENAMES
8825  .memberName = "name",
8826 #endif
8827  .namespaceZero = true,
8828  .padding = 0,
8829  .isArray = false
8830  },
8831  { .memberTypeIndex = UA_TYPES_NODEID,
8832 #ifdef UA_ENABLE_TYPENAMES
8833  .memberName = "dataType",
8834 #endif
8835  .namespaceZero = true,
8836  .padding = offsetof(UA_Argument, dataType) - offsetof(UA_Argument, name) - sizeof(UA_String),
8837  .isArray = false
8838  },
8839  { .memberTypeIndex = UA_TYPES_INT32,
8840 #ifdef UA_ENABLE_TYPENAMES
8841  .memberName = "valueRank",
8842 #endif
8843  .namespaceZero = true,
8844  .padding = offsetof(UA_Argument, valueRank) - offsetof(UA_Argument, dataType) - sizeof(UA_NodeId),
8845  .isArray = false
8846  },
8847  { .memberTypeIndex = UA_TYPES_UINT32,
8848 #ifdef UA_ENABLE_TYPENAMES
8849  .memberName = "arrayDimensions",
8850 #endif
8851  .namespaceZero = true,
8852  .padding = offsetof(UA_Argument, arrayDimensionsSize) - offsetof(UA_Argument, valueRank) - sizeof(UA_Int32),
8853  .isArray = true
8854  },
8855  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8856 #ifdef UA_ENABLE_TYPENAMES
8857  .memberName = "description",
8858 #endif
8859  .namespaceZero = true,
8860  .padding = offsetof(UA_Argument, description) - offsetof(UA_Argument, arrayDimensions) - sizeof(void*),
8861  .isArray = false
8862  },};
8863 
8864 /* UserIdentityToken */
8865 static UA_DataTypeMember UserIdentityToken_members[1] = {
8867 #ifdef UA_ENABLE_TYPENAMES
8868  .memberName = "policyId",
8869 #endif
8870  .namespaceZero = true,
8871  .padding = 0,
8872  .isArray = false
8873  },};
8874 
8875 /* ObjectTypeAttributes */
8876 static UA_DataTypeMember ObjectTypeAttributes_members[6] = {
8878 #ifdef UA_ENABLE_TYPENAMES
8879  .memberName = "specifiedAttributes",
8880 #endif
8881  .namespaceZero = true,
8882  .padding = 0,
8883  .isArray = false
8884  },
8885  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8886 #ifdef UA_ENABLE_TYPENAMES
8887  .memberName = "displayName",
8888 #endif
8889  .namespaceZero = true,
8890  .padding = offsetof(UA_ObjectTypeAttributes, displayName) - offsetof(UA_ObjectTypeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
8891  .isArray = false
8892  },
8893  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8894 #ifdef UA_ENABLE_TYPENAMES
8895  .memberName = "description",
8896 #endif
8897  .namespaceZero = true,
8898  .padding = offsetof(UA_ObjectTypeAttributes, description) - offsetof(UA_ObjectTypeAttributes, displayName) - sizeof(UA_LocalizedText),
8899  .isArray = false
8900  },
8901  { .memberTypeIndex = UA_TYPES_UINT32,
8902 #ifdef UA_ENABLE_TYPENAMES
8903  .memberName = "writeMask",
8904 #endif
8905  .namespaceZero = true,
8906  .padding = offsetof(UA_ObjectTypeAttributes, writeMask) - offsetof(UA_ObjectTypeAttributes, description) - sizeof(UA_LocalizedText),
8907  .isArray = false
8908  },
8909  { .memberTypeIndex = UA_TYPES_UINT32,
8910 #ifdef UA_ENABLE_TYPENAMES
8911  .memberName = "userWriteMask",
8912 #endif
8913  .namespaceZero = true,
8914  .padding = offsetof(UA_ObjectTypeAttributes, userWriteMask) - offsetof(UA_ObjectTypeAttributes, writeMask) - sizeof(UA_UInt32),
8915  .isArray = false
8916  },
8917  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8918 #ifdef UA_ENABLE_TYPENAMES
8919  .memberName = "isAbstract",
8920 #endif
8921  .namespaceZero = true,
8922  .padding = offsetof(UA_ObjectTypeAttributes, isAbstract) - offsetof(UA_ObjectTypeAttributes, userWriteMask) - sizeof(UA_UInt32),
8923  .isArray = false
8924  },};
8925 
8926 /* DeadbandType */
8927 static UA_DataTypeMember DeadbandType_members[1] = {
8929 #ifdef UA_ENABLE_TYPENAMES
8930  .memberName = "",
8931 #endif
8932  .namespaceZero = true,
8933  .padding = 0,
8934  .isArray = false
8935  },};
8936 
8937 /* SecurityTokenRequestType */
8938 static UA_DataTypeMember SecurityTokenRequestType_members[1] = {
8940 #ifdef UA_ENABLE_TYPENAMES
8941  .memberName = "",
8942 #endif
8943  .namespaceZero = true,
8944  .padding = 0,
8945  .isArray = false
8946  },};
8947 
8948 /* DataChangeTrigger */
8949 static UA_DataTypeMember DataChangeTrigger_members[1] = {
8951 #ifdef UA_ENABLE_TYPENAMES
8952  .memberName = "",
8953 #endif
8954  .namespaceZero = true,
8955  .padding = 0,
8956  .isArray = false
8957  },};
8958 
8959 /* BuildInfo */
8960 static UA_DataTypeMember BuildInfo_members[6] = {
8962 #ifdef UA_ENABLE_TYPENAMES
8963  .memberName = "productUri",
8964 #endif
8965  .namespaceZero = true,
8966  .padding = 0,
8967  .isArray = false
8968  },
8969  { .memberTypeIndex = UA_TYPES_STRING,
8970 #ifdef UA_ENABLE_TYPENAMES
8971  .memberName = "manufacturerName",
8972 #endif
8973  .namespaceZero = true,
8974  .padding = offsetof(UA_BuildInfo, manufacturerName) - offsetof(UA_BuildInfo, productUri) - sizeof(UA_String),
8975  .isArray = false
8976  },
8977  { .memberTypeIndex = UA_TYPES_STRING,
8978 #ifdef UA_ENABLE_TYPENAMES
8979  .memberName = "productName",
8980 #endif
8981  .namespaceZero = true,
8982  .padding = offsetof(UA_BuildInfo, productName) - offsetof(UA_BuildInfo, manufacturerName) - sizeof(UA_String),
8983  .isArray = false
8984  },
8985  { .memberTypeIndex = UA_TYPES_STRING,
8986 #ifdef UA_ENABLE_TYPENAMES
8987  .memberName = "softwareVersion",
8988 #endif
8989  .namespaceZero = true,
8990  .padding = offsetof(UA_BuildInfo, softwareVersion) - offsetof(UA_BuildInfo, productName) - sizeof(UA_String),
8991  .isArray = false
8992  },
8993  { .memberTypeIndex = UA_TYPES_STRING,
8994 #ifdef UA_ENABLE_TYPENAMES
8995  .memberName = "buildNumber",
8996 #endif
8997  .namespaceZero = true,
8998  .padding = offsetof(UA_BuildInfo, buildNumber) - offsetof(UA_BuildInfo, softwareVersion) - sizeof(UA_String),
8999  .isArray = false
9000  },
9001  { .memberTypeIndex = UA_TYPES_DATETIME,
9002 #ifdef UA_ENABLE_TYPENAMES
9003  .memberName = "buildDate",
9004 #endif
9005  .namespaceZero = true,
9006  .padding = offsetof(UA_BuildInfo, buildDate) - offsetof(UA_BuildInfo, buildNumber) - sizeof(UA_String),
9007  .isArray = false
9008  },};
9009 
9010 /* NodeClass */
9011 static UA_DataTypeMember NodeClass_members[1] = {
9013 #ifdef UA_ENABLE_TYPENAMES
9014  .memberName = "",
9015 #endif
9016  .namespaceZero = true,
9017  .padding = 0,
9018  .isArray = false
9019  },};
9020 
9021 /* ChannelSecurityToken */
9022 static UA_DataTypeMember ChannelSecurityToken_members[4] = {
9024 #ifdef UA_ENABLE_TYPENAMES
9025  .memberName = "channelId",
9026 #endif
9027  .namespaceZero = true,
9028  .padding = 0,
9029  .isArray = false
9030  },
9031  { .memberTypeIndex = UA_TYPES_UINT32,
9032 #ifdef UA_ENABLE_TYPENAMES
9033  .memberName = "tokenId",
9034 #endif
9035  .namespaceZero = true,
9036  .padding = offsetof(UA_ChannelSecurityToken, tokenId) - offsetof(UA_ChannelSecurityToken, channelId) - sizeof(UA_UInt32),
9037  .isArray = false
9038  },
9039  { .memberTypeIndex = UA_TYPES_DATETIME,
9040 #ifdef UA_ENABLE_TYPENAMES
9041  .memberName = "createdAt",
9042 #endif
9043  .namespaceZero = true,
9044  .padding = offsetof(UA_ChannelSecurityToken, createdAt) - offsetof(UA_ChannelSecurityToken, tokenId) - sizeof(UA_UInt32),
9045  .isArray = false
9046  },
9047  { .memberTypeIndex = UA_TYPES_UINT32,
9048 #ifdef UA_ENABLE_TYPENAMES
9049  .memberName = "revisedLifetime",
9050 #endif
9051  .namespaceZero = true,
9052  .padding = offsetof(UA_ChannelSecurityToken, revisedLifetime) - offsetof(UA_ChannelSecurityToken, createdAt) - sizeof(UA_DateTime),
9053  .isArray = false
9054  },};
9055 
9056 /* MonitoredItemNotification */
9057 static UA_DataTypeMember MonitoredItemNotification_members[2] = {
9059 #ifdef UA_ENABLE_TYPENAMES
9060  .memberName = "clientHandle",
9061 #endif
9062  .namespaceZero = true,
9063  .padding = 0,
9064  .isArray = false
9065  },
9066  { .memberTypeIndex = UA_TYPES_DATAVALUE,
9067 #ifdef UA_ENABLE_TYPENAMES
9068  .memberName = "value",
9069 #endif
9070  .namespaceZero = true,
9071  .padding = offsetof(UA_MonitoredItemNotification, value) - offsetof(UA_MonitoredItemNotification, clientHandle) - sizeof(UA_UInt32),
9072  .isArray = false
9073  },};
9074 
9075 /* DeleteNodesItem */
9076 static UA_DataTypeMember DeleteNodesItem_members[2] = {
9078 #ifdef UA_ENABLE_TYPENAMES
9079  .memberName = "nodeId",
9080 #endif
9081  .namespaceZero = true,
9082  .padding = 0,
9083  .isArray = false
9084  },
9085  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9086 #ifdef UA_ENABLE_TYPENAMES
9087  .memberName = "deleteTargetReferences",
9088 #endif
9089  .namespaceZero = true,
9090  .padding = offsetof(UA_DeleteNodesItem, deleteTargetReferences) - offsetof(UA_DeleteNodesItem, nodeId) - sizeof(UA_NodeId),
9091  .isArray = false
9092  },};
9093 
9094 /* SubscriptionAcknowledgement */
9095 static UA_DataTypeMember SubscriptionAcknowledgement_members[2] = {
9097 #ifdef UA_ENABLE_TYPENAMES
9098  .memberName = "subscriptionId",
9099 #endif
9100  .namespaceZero = true,
9101  .padding = 0,
9102  .isArray = false
9103  },
9104  { .memberTypeIndex = UA_TYPES_UINT32,
9105 #ifdef UA_ENABLE_TYPENAMES
9106  .memberName = "sequenceNumber",
9107 #endif
9108  .namespaceZero = true,
9109  .padding = offsetof(UA_SubscriptionAcknowledgement, sequenceNumber) - offsetof(UA_SubscriptionAcknowledgement, subscriptionId) - sizeof(UA_UInt32),
9110  .isArray = false
9111  },};
9112 
9113 /* ReadValueId */
9114 static UA_DataTypeMember ReadValueId_members[4] = {
9116 #ifdef UA_ENABLE_TYPENAMES
9117  .memberName = "nodeId",
9118 #endif
9119  .namespaceZero = true,
9120  .padding = 0,
9121  .isArray = false
9122  },
9123  { .memberTypeIndex = UA_TYPES_UINT32,
9124 #ifdef UA_ENABLE_TYPENAMES
9125  .memberName = "attributeId",
9126 #endif
9127  .namespaceZero = true,
9128  .padding = offsetof(UA_ReadValueId, attributeId) - offsetof(UA_ReadValueId, nodeId) - sizeof(UA_NodeId),
9129  .isArray = false
9130  },
9131  { .memberTypeIndex = UA_TYPES_STRING,
9132 #ifdef UA_ENABLE_TYPENAMES
9133  .memberName = "indexRange",
9134 #endif
9135  .namespaceZero = true,
9136  .padding = offsetof(UA_ReadValueId, indexRange) - offsetof(UA_ReadValueId, attributeId) - sizeof(UA_UInt32),
9137  .isArray = false
9138  },
9139  { .memberTypeIndex = UA_TYPES_QUALIFIEDNAME,
9140 #ifdef UA_ENABLE_TYPENAMES
9141  .memberName = "dataEncoding",
9142 #endif
9143  .namespaceZero = true,
9144  .padding = offsetof(UA_ReadValueId, dataEncoding) - offsetof(UA_ReadValueId, indexRange) - sizeof(UA_String),
9145  .isArray = false
9146  },};
9147 
9148 /* DataTypeAttributes */
9149 static UA_DataTypeMember DataTypeAttributes_members[6] = {
9151 #ifdef UA_ENABLE_TYPENAMES
9152  .memberName = "specifiedAttributes",
9153 #endif
9154  .namespaceZero = true,
9155  .padding = 0,
9156  .isArray = false
9157  },
9158  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9159 #ifdef UA_ENABLE_TYPENAMES
9160  .memberName = "displayName",
9161 #endif
9162  .namespaceZero = true,
9163  .padding = offsetof(UA_DataTypeAttributes, displayName) - offsetof(UA_DataTypeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
9164  .isArray = false
9165  },
9166  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9167 #ifdef UA_ENABLE_TYPENAMES
9168  .memberName = "description",
9169 #endif
9170  .namespaceZero = true,
9171  .padding = offsetof(UA_DataTypeAttributes, description) - offsetof(UA_DataTypeAttributes, displayName) - sizeof(UA_LocalizedText),
9172  .isArray = false
9173  },
9174  { .memberTypeIndex = UA_TYPES_UINT32,
9175 #ifdef UA_ENABLE_TYPENAMES
9176  .memberName = "writeMask",
9177 #endif
9178  .namespaceZero = true,
9179  .padding = offsetof(UA_DataTypeAttributes, writeMask) - offsetof(UA_DataTypeAttributes, description) - sizeof(UA_LocalizedText),
9180  .isArray = false
9181  },
9182  { .memberTypeIndex = UA_TYPES_UINT32,
9183 #ifdef UA_ENABLE_TYPENAMES
9184  .memberName = "userWriteMask",
9185 #endif
9186  .namespaceZero = true,
9187  .padding = offsetof(UA_DataTypeAttributes, userWriteMask) - offsetof(UA_DataTypeAttributes, writeMask) - sizeof(UA_UInt32),
9188  .isArray = false
9189  },
9190  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9191 #ifdef UA_ENABLE_TYPENAMES
9192  .memberName = "isAbstract",
9193 #endif
9194  .namespaceZero = true,
9195  .padding = offsetof(UA_DataTypeAttributes, isAbstract) - offsetof(UA_DataTypeAttributes, userWriteMask) - sizeof(UA_UInt32),
9196  .isArray = false
9197  },};
9198 
9199 /* ResponseHeader */
9200 static UA_DataTypeMember ResponseHeader_members[6] = {
9202 #ifdef UA_ENABLE_TYPENAMES
9203  .memberName = "timestamp",
9204 #endif
9205  .namespaceZero = true,
9206  .padding = 0,
9207  .isArray = false
9208  },
9209  { .memberTypeIndex = UA_TYPES_UINT32,
9210 #ifdef UA_ENABLE_TYPENAMES
9211  .memberName = "requestHandle",
9212 #endif
9213  .namespaceZero = true,
9214  .padding = offsetof(UA_ResponseHeader, requestHandle) - offsetof(UA_ResponseHeader, timestamp) - sizeof(UA_DateTime),
9215  .isArray = false
9216  },
9217  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9218 #ifdef UA_ENABLE_TYPENAMES
9219  .memberName = "serviceResult",
9220 #endif
9221  .namespaceZero = true,
9222  .padding = offsetof(UA_ResponseHeader, serviceResult) - offsetof(UA_ResponseHeader, requestHandle) - sizeof(UA_UInt32),
9223  .isArray = false
9224  },
9225  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9226 #ifdef UA_ENABLE_TYPENAMES
9227  .memberName = "serviceDiagnostics",
9228 #endif
9229  .namespaceZero = true,
9230  .padding = offsetof(UA_ResponseHeader, serviceDiagnostics) - offsetof(UA_ResponseHeader, serviceResult) - sizeof(UA_StatusCode),
9231  .isArray = false
9232  },
9233  { .memberTypeIndex = UA_TYPES_STRING,
9234 #ifdef UA_ENABLE_TYPENAMES
9235  .memberName = "stringTable",
9236 #endif
9237  .namespaceZero = true,
9238  .padding = offsetof(UA_ResponseHeader, stringTableSize) - offsetof(UA_ResponseHeader, serviceDiagnostics) - sizeof(UA_DiagnosticInfo),
9239  .isArray = true
9240  },
9241  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
9242 #ifdef UA_ENABLE_TYPENAMES
9243  .memberName = "additionalHeader",
9244 #endif
9245  .namespaceZero = true,
9246  .padding = offsetof(UA_ResponseHeader, additionalHeader) - offsetof(UA_ResponseHeader, stringTable) - sizeof(void*),
9247  .isArray = false
9248  },};
9249 
9250 /* DeleteSubscriptionsRequest */
9251 static UA_DataTypeMember DeleteSubscriptionsRequest_members[2] = {
9253 #ifdef UA_ENABLE_TYPENAMES
9254  .memberName = "requestHeader",
9255 #endif
9256  .namespaceZero = true,
9257  .padding = 0,
9258  .isArray = false
9259  },
9260  { .memberTypeIndex = UA_TYPES_UINT32,
9261 #ifdef UA_ENABLE_TYPENAMES
9262  .memberName = "subscriptionIds",
9263 #endif
9264  .namespaceZero = true,
9265  .padding = offsetof(UA_DeleteSubscriptionsRequest, subscriptionIdsSize) - offsetof(UA_DeleteSubscriptionsRequest, requestHeader) - sizeof(UA_RequestHeader),
9266  .isArray = true
9267  },};
9268 
9269 /* ViewDescription */
9270 static UA_DataTypeMember ViewDescription_members[3] = {
9272 #ifdef UA_ENABLE_TYPENAMES
9273  .memberName = "viewId",
9274 #endif
9275  .namespaceZero = true,
9276  .padding = 0,
9277  .isArray = false
9278  },
9279  { .memberTypeIndex = UA_TYPES_DATETIME,
9280 #ifdef UA_ENABLE_TYPENAMES
9281  .memberName = "timestamp",
9282 #endif
9283  .namespaceZero = true,
9284  .padding = offsetof(UA_ViewDescription, timestamp) - offsetof(UA_ViewDescription, viewId) - sizeof(UA_NodeId),
9285  .isArray = false
9286  },
9287  { .memberTypeIndex = UA_TYPES_UINT32,
9288 #ifdef UA_ENABLE_TYPENAMES
9289  .memberName = "viewVersion",
9290 #endif
9291  .namespaceZero = true,
9292  .padding = offsetof(UA_ViewDescription, viewVersion) - offsetof(UA_ViewDescription, timestamp) - sizeof(UA_DateTime),
9293  .isArray = false
9294  },};
9295 
9296 /* DeleteMonitoredItemsResponse */
9297 static UA_DataTypeMember DeleteMonitoredItemsResponse_members[3] = {
9299 #ifdef UA_ENABLE_TYPENAMES
9300  .memberName = "responseHeader",
9301 #endif
9302  .namespaceZero = true,
9303  .padding = 0,
9304  .isArray = false
9305  },
9306  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9307 #ifdef UA_ENABLE_TYPENAMES
9308  .memberName = "results",
9309 #endif
9310  .namespaceZero = true,
9311  .padding = offsetof(UA_DeleteMonitoredItemsResponse, resultsSize) - offsetof(UA_DeleteMonitoredItemsResponse, responseHeader) - sizeof(UA_ResponseHeader),
9312  .isArray = true
9313  },
9314  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9315 #ifdef UA_ENABLE_TYPENAMES
9316  .memberName = "diagnosticInfos",
9317 #endif
9318  .namespaceZero = true,
9319  .padding = offsetof(UA_DeleteMonitoredItemsResponse, diagnosticInfosSize) - offsetof(UA_DeleteMonitoredItemsResponse, results) - sizeof(void*),
9320  .isArray = true
9321  },};
9322 
9323 /* NodeAttributes */
9324 static UA_DataTypeMember NodeAttributes_members[5] = {
9326 #ifdef UA_ENABLE_TYPENAMES
9327  .memberName = "specifiedAttributes",
9328 #endif
9329  .namespaceZero = true,
9330  .padding = 0,
9331  .isArray = false
9332  },
9333  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9334 #ifdef UA_ENABLE_TYPENAMES
9335  .memberName = "displayName",
9336 #endif
9337  .namespaceZero = true,
9338  .padding = offsetof(UA_NodeAttributes, displayName) - offsetof(UA_NodeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
9339  .isArray = false
9340  },
9341  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9342 #ifdef UA_ENABLE_TYPENAMES
9343  .memberName = "description",
9344 #endif
9345  .namespaceZero = true,
9346  .padding = offsetof(UA_NodeAttributes, description) - offsetof(UA_NodeAttributes, displayName) - sizeof(UA_LocalizedText),
9347  .isArray = false
9348  },
9349  { .memberTypeIndex = UA_TYPES_UINT32,
9350 #ifdef UA_ENABLE_TYPENAMES
9351  .memberName = "writeMask",
9352 #endif
9353  .namespaceZero = true,
9354  .padding = offsetof(UA_NodeAttributes, writeMask) - offsetof(UA_NodeAttributes, description) - sizeof(UA_LocalizedText),
9355  .isArray = false
9356  },
9357  { .memberTypeIndex = UA_TYPES_UINT32,
9358 #ifdef UA_ENABLE_TYPENAMES
9359  .memberName = "userWriteMask",
9360 #endif
9361  .namespaceZero = true,
9362  .padding = offsetof(UA_NodeAttributes, userWriteMask) - offsetof(UA_NodeAttributes, writeMask) - sizeof(UA_UInt32),
9363  .isArray = false
9364  },};
9365 
9366 /* RegisterNodesRequest */
9367 static UA_DataTypeMember RegisterNodesRequest_members[2] = {
9369 #ifdef UA_ENABLE_TYPENAMES
9370  .memberName = "requestHeader",
9371 #endif
9372  .namespaceZero = true,
9373  .padding = 0,
9374  .isArray = false
9375  },
9376  { .memberTypeIndex = UA_TYPES_NODEID,
9377 #ifdef UA_ENABLE_TYPENAMES
9378  .memberName = "nodesToRegister",
9379 #endif
9380  .namespaceZero = true,
9381  .padding = offsetof(UA_RegisterNodesRequest, nodesToRegisterSize) - offsetof(UA_RegisterNodesRequest, requestHeader) - sizeof(UA_RequestHeader),
9382  .isArray = true
9383  },};
9384 
9385 /* DeleteNodesRequest */
9386 static UA_DataTypeMember DeleteNodesRequest_members[2] = {
9388 #ifdef UA_ENABLE_TYPENAMES
9389  .memberName = "requestHeader",
9390 #endif
9391  .namespaceZero = true,
9392  .padding = 0,
9393  .isArray = false
9394  },
9395  { .memberTypeIndex = UA_TYPES_DELETENODESITEM,
9396 #ifdef UA_ENABLE_TYPENAMES
9397  .memberName = "nodesToDelete",
9398 #endif
9399  .namespaceZero = true,
9400  .padding = offsetof(UA_DeleteNodesRequest, nodesToDeleteSize) - offsetof(UA_DeleteNodesRequest, requestHeader) - sizeof(UA_RequestHeader),
9401  .isArray = true
9402  },};
9403 
9404 /* PublishResponse */
9405 static UA_DataTypeMember PublishResponse_members[7] = {
9407 #ifdef UA_ENABLE_TYPENAMES
9408  .memberName = "responseHeader",
9409 #endif
9410  .namespaceZero = true,
9411  .padding = 0,
9412  .isArray = false
9413  },
9414  { .memberTypeIndex = UA_TYPES_UINT32,
9415 #ifdef UA_ENABLE_TYPENAMES
9416  .memberName = "subscriptionId",
9417 #endif
9418  .namespaceZero = true,
9419  .padding = offsetof(UA_PublishResponse, subscriptionId) - offsetof(UA_PublishResponse, responseHeader) - sizeof(UA_ResponseHeader),
9420  .isArray = false
9421  },
9422  { .memberTypeIndex = UA_TYPES_UINT32,
9423 #ifdef UA_ENABLE_TYPENAMES
9424  .memberName = "availableSequenceNumbers",
9425 #endif
9426  .namespaceZero = true,
9427  .padding = offsetof(UA_PublishResponse, availableSequenceNumbersSize) - offsetof(UA_PublishResponse, subscriptionId) - sizeof(UA_UInt32),
9428  .isArray = true
9429  },
9430  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9431 #ifdef UA_ENABLE_TYPENAMES
9432  .memberName = "moreNotifications",
9433 #endif
9434  .namespaceZero = true,
9435  .padding = offsetof(UA_PublishResponse, moreNotifications) - offsetof(UA_PublishResponse, availableSequenceNumbers) - sizeof(void*),
9436  .isArray = false
9437  },
9438  { .memberTypeIndex = UA_TYPES_NOTIFICATIONMESSAGE,
9439 #ifdef UA_ENABLE_TYPENAMES
9440  .memberName = "notificationMessage",
9441 #endif
9442  .namespaceZero = true,
9443  .padding = offsetof(UA_PublishResponse, notificationMessage) - offsetof(UA_PublishResponse, moreNotifications) - sizeof(UA_Boolean),
9444  .isArray = false
9445  },
9446  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9447 #ifdef UA_ENABLE_TYPENAMES
9448  .memberName = "results",
9449 #endif
9450  .namespaceZero = true,
9451  .padding = offsetof(UA_PublishResponse, resultsSize) - offsetof(UA_PublishResponse, notificationMessage) - sizeof(UA_NotificationMessage),
9452  .isArray = true
9453  },
9454  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9455 #ifdef UA_ENABLE_TYPENAMES
9456  .memberName = "diagnosticInfos",
9457 #endif
9458  .namespaceZero = true,
9459  .padding = offsetof(UA_PublishResponse, diagnosticInfosSize) - offsetof(UA_PublishResponse, results) - sizeof(void*),
9460  .isArray = true
9461  },};
9462 
9463 /* MonitoredItemModifyRequest */
9464 static UA_DataTypeMember MonitoredItemModifyRequest_members[2] = {
9466 #ifdef UA_ENABLE_TYPENAMES
9467  .memberName = "monitoredItemId",
9468 #endif
9469  .namespaceZero = true,
9470  .padding = 0,
9471  .isArray = false
9472  },
9473  { .memberTypeIndex = UA_TYPES_MONITORINGPARAMETERS,
9474 #ifdef UA_ENABLE_TYPENAMES
9475  .memberName = "requestedParameters",
9476 #endif
9477  .namespaceZero = true,
9478  .padding = offsetof(UA_MonitoredItemModifyRequest, requestedParameters) - offsetof(UA_MonitoredItemModifyRequest, monitoredItemId) - sizeof(UA_UInt32),
9479  .isArray = false
9480  },};
9481 
9482 /* UserNameIdentityToken */
9483 static UA_DataTypeMember UserNameIdentityToken_members[4] = {
9485 #ifdef UA_ENABLE_TYPENAMES
9486  .memberName = "policyId",
9487 #endif
9488  .namespaceZero = true,
9489  .padding = 0,
9490  .isArray = false
9491  },
9492  { .memberTypeIndex = UA_TYPES_STRING,
9493 #ifdef UA_ENABLE_TYPENAMES
9494  .memberName = "userName",
9495 #endif
9496  .namespaceZero = true,
9497  .padding = offsetof(UA_UserNameIdentityToken, userName) - offsetof(UA_UserNameIdentityToken, policyId) - sizeof(UA_String),
9498  .isArray = false
9499  },
9500  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9501 #ifdef UA_ENABLE_TYPENAMES
9502  .memberName = "password",
9503 #endif
9504  .namespaceZero = true,
9505  .padding = offsetof(UA_UserNameIdentityToken, password) - offsetof(UA_UserNameIdentityToken, userName) - sizeof(UA_String),
9506  .isArray = false
9507  },
9508  { .memberTypeIndex = UA_TYPES_STRING,
9509 #ifdef UA_ENABLE_TYPENAMES
9510  .memberName = "encryptionAlgorithm",
9511 #endif
9512  .namespaceZero = true,
9513  .padding = offsetof(UA_UserNameIdentityToken, encryptionAlgorithm) - offsetof(UA_UserNameIdentityToken, password) - sizeof(UA_ByteString),
9514  .isArray = false
9515  },};
9516 
9517 /* IdType */
9518 static UA_DataTypeMember IdType_members[1] = {
9520 #ifdef UA_ENABLE_TYPENAMES
9521  .memberName = "",
9522 #endif
9523  .namespaceZero = true,
9524  .padding = 0,
9525  .isArray = false
9526  },};
9527 
9528 /* UserTokenType */
9529 static UA_DataTypeMember UserTokenType_members[1] = {
9531 #ifdef UA_ENABLE_TYPENAMES
9532  .memberName = "",
9533 #endif
9534  .namespaceZero = true,
9535  .padding = 0,
9536  .isArray = false
9537  },};
9538 
9539 /* ActivateSessionRequest */
9540 static UA_DataTypeMember ActivateSessionRequest_members[6] = {
9542 #ifdef UA_ENABLE_TYPENAMES
9543  .memberName = "requestHeader",
9544 #endif
9545  .namespaceZero = true,
9546  .padding = 0,
9547  .isArray = false
9548  },
9549  { .memberTypeIndex = UA_TYPES_SIGNATUREDATA,
9550 #ifdef UA_ENABLE_TYPENAMES
9551  .memberName = "clientSignature",
9552 #endif
9553  .namespaceZero = true,
9554  .padding = offsetof(UA_ActivateSessionRequest, clientSignature) - offsetof(UA_ActivateSessionRequest, requestHeader) - sizeof(UA_RequestHeader),
9555  .isArray = false
9556  },
9557  { .memberTypeIndex = UA_TYPES_SIGNEDSOFTWARECERTIFICATE,
9558 #ifdef UA_ENABLE_TYPENAMES
9559  .memberName = "clientSoftwareCertificates",
9560 #endif
9561  .namespaceZero = true,
9562  .padding = offsetof(UA_ActivateSessionRequest, clientSoftwareCertificatesSize) - offsetof(UA_ActivateSessionRequest, clientSignature) - sizeof(UA_SignatureData),
9563  .isArray = true
9564  },
9565  { .memberTypeIndex = UA_TYPES_STRING,
9566 #ifdef UA_ENABLE_TYPENAMES
9567  .memberName = "localeIds",
9568 #endif
9569  .namespaceZero = true,
9570  .padding = offsetof(UA_ActivateSessionRequest, localeIdsSize) - offsetof(UA_ActivateSessionRequest, clientSoftwareCertificates) - sizeof(void*),
9571  .isArray = true
9572  },
9573  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
9574 #ifdef UA_ENABLE_TYPENAMES
9575  .memberName = "userIdentityToken",
9576 #endif
9577  .namespaceZero = true,
9578  .padding = offsetof(UA_ActivateSessionRequest, userIdentityToken) - offsetof(UA_ActivateSessionRequest, localeIds) - sizeof(void*),
9579  .isArray = false
9580  },
9581  { .memberTypeIndex = UA_TYPES_SIGNATUREDATA,
9582 #ifdef UA_ENABLE_TYPENAMES
9583  .memberName = "userTokenSignature",
9584 #endif
9585  .namespaceZero = true,
9586  .padding = offsetof(UA_ActivateSessionRequest, userTokenSignature) - offsetof(UA_ActivateSessionRequest, userIdentityToken) - sizeof(UA_ExtensionObject),
9587  .isArray = false
9588  },};
9589 
9590 /* OpenSecureChannelResponse */
9591 static UA_DataTypeMember OpenSecureChannelResponse_members[4] = {
9593 #ifdef UA_ENABLE_TYPENAMES
9594  .memberName = "responseHeader",
9595 #endif
9596  .namespaceZero = true,
9597  .padding = 0,
9598  .isArray = false
9599  },
9600  { .memberTypeIndex = UA_TYPES_UINT32,
9601 #ifdef UA_ENABLE_TYPENAMES
9602  .memberName = "serverProtocolVersion",
9603 #endif
9604  .namespaceZero = true,
9605  .padding = offsetof(UA_OpenSecureChannelResponse, serverProtocolVersion) - offsetof(UA_OpenSecureChannelResponse, responseHeader) - sizeof(UA_ResponseHeader),
9606  .isArray = false
9607  },
9608  { .memberTypeIndex = UA_TYPES_CHANNELSECURITYTOKEN,
9609 #ifdef UA_ENABLE_TYPENAMES
9610  .memberName = "securityToken",
9611 #endif
9612  .namespaceZero = true,
9613  .padding = offsetof(UA_OpenSecureChannelResponse, securityToken) - offsetof(UA_OpenSecureChannelResponse, serverProtocolVersion) - sizeof(UA_UInt32),
9614  .isArray = false
9615  },
9616  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9617 #ifdef UA_ENABLE_TYPENAMES
9618  .memberName = "serverNonce",
9619 #endif
9620  .namespaceZero = true,
9621  .padding = offsetof(UA_OpenSecureChannelResponse, serverNonce) - offsetof(UA_OpenSecureChannelResponse, securityToken) - sizeof(UA_ChannelSecurityToken),
9622  .isArray = false
9623  },};
9624 
9625 /* ApplicationType */
9626 static UA_DataTypeMember ApplicationType_members[1] = {
9628 #ifdef UA_ENABLE_TYPENAMES
9629  .memberName = "",
9630 #endif
9631  .namespaceZero = true,
9632  .padding = 0,
9633  .isArray = false
9634  },};
9635 
9636 /* ServerState */
9637 static UA_DataTypeMember ServerState_members[1] = {
9639 #ifdef UA_ENABLE_TYPENAMES
9640  .memberName = "",
9641 #endif
9642  .namespaceZero = true,
9643  .padding = 0,
9644  .isArray = false
9645  },};
9646 
9647 /* QueryNextResponse */
9648 static UA_DataTypeMember QueryNextResponse_members[3] = {
9650 #ifdef UA_ENABLE_TYPENAMES
9651  .memberName = "responseHeader",
9652 #endif
9653  .namespaceZero = true,
9654  .padding = 0,
9655  .isArray = false
9656  },
9657  { .memberTypeIndex = UA_TYPES_QUERYDATASET,
9658 #ifdef UA_ENABLE_TYPENAMES
9659  .memberName = "queryDataSets",
9660 #endif
9661  .namespaceZero = true,
9662  .padding = offsetof(UA_QueryNextResponse, queryDataSetsSize) - offsetof(UA_QueryNextResponse, responseHeader) - sizeof(UA_ResponseHeader),
9663  .isArray = true
9664  },
9665  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9666 #ifdef UA_ENABLE_TYPENAMES
9667  .memberName = "revisedContinuationPoint",
9668 #endif
9669  .namespaceZero = true,
9670  .padding = offsetof(UA_QueryNextResponse, revisedContinuationPoint) - offsetof(UA_QueryNextResponse, queryDataSets) - sizeof(void*),
9671  .isArray = false
9672  },};
9673 
9674 /* ActivateSessionResponse */
9675 static UA_DataTypeMember ActivateSessionResponse_members[4] = {
9677 #ifdef UA_ENABLE_TYPENAMES
9678  .memberName = "responseHeader",
9679 #endif
9680  .namespaceZero = true,
9681  .padding = 0,
9682  .isArray = false
9683  },
9684  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9685 #ifdef UA_ENABLE_TYPENAMES
9686  .memberName = "serverNonce",
9687 #endif
9688  .namespaceZero = true,
9689  .padding = offsetof(UA_ActivateSessionResponse, serverNonce) - offsetof(UA_ActivateSessionResponse, responseHeader) - sizeof(UA_ResponseHeader),
9690  .isArray = false
9691  },
9692  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9693 #ifdef UA_ENABLE_TYPENAMES
9694  .memberName = "results",
9695 #endif
9696  .namespaceZero = true,
9697  .padding = offsetof(UA_ActivateSessionResponse, resultsSize) - offsetof(UA_ActivateSessionResponse, serverNonce) - sizeof(UA_ByteString),
9698  .isArray = true
9699  },
9700  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9701 #ifdef UA_ENABLE_TYPENAMES
9702  .memberName = "diagnosticInfos",
9703 #endif
9704  .namespaceZero = true,
9705  .padding = offsetof(UA_ActivateSessionResponse, diagnosticInfosSize) - offsetof(UA_ActivateSessionResponse, results) - sizeof(void*),
9706  .isArray = true
9707  },};
9708 
9709 /* FilterOperator */
9710 static UA_DataTypeMember FilterOperator_members[1] = {
9712 #ifdef UA_ENABLE_TYPENAMES
9713  .memberName = "",
9714 #endif
9715  .namespaceZero = true,
9716  .padding = 0,
9717  .isArray = false
9718  },};
9719 
9720 /* QueryNextRequest */
9721 static UA_DataTypeMember QueryNextRequest_members[3] = {
9723 #ifdef UA_ENABLE_TYPENAMES
9724  .memberName = "requestHeader",
9725 #endif
9726  .namespaceZero = true,
9727  .padding = 0,
9728  .isArray = false
9729  },
9730  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9731 #ifdef UA_ENABLE_TYPENAMES
9732  .memberName = "releaseContinuationPoint",
9733 #endif
9734  .namespaceZero = true,
9735  .padding = offsetof(UA_QueryNextRequest, releaseContinuationPoint) - offsetof(UA_QueryNextRequest, requestHeader) - sizeof(UA_RequestHeader),
9736  .isArray = false
9737  },
9738  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9739 #ifdef UA_ENABLE_TYPENAMES
9740  .memberName = "continuationPoint",
9741 #endif
9742  .namespaceZero = true,
9743  .padding = offsetof(UA_QueryNextRequest, continuationPoint) - offsetof(UA_QueryNextRequest, releaseContinuationPoint) - sizeof(UA_Boolean),
9744  .isArray = false
9745  },};
9746 
9747 /* WriteResponse */
9748 static UA_DataTypeMember WriteResponse_members[3] = {
9750 #ifdef UA_ENABLE_TYPENAMES
9751  .memberName = "responseHeader",
9752 #endif
9753  .namespaceZero = true,
9754  .padding = 0,
9755  .isArray = false
9756  },
9757  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9758 #ifdef UA_ENABLE_TYPENAMES
9759  .memberName = "results",
9760 #endif
9761  .namespaceZero = true,
9762  .padding = offsetof(UA_WriteResponse, resultsSize) - offsetof(UA_WriteResponse, responseHeader) - sizeof(UA_ResponseHeader),
9763  .isArray = true
9764  },
9765  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9766 #ifdef UA_ENABLE_TYPENAMES
9767  .memberName = "diagnosticInfos",
9768 #endif
9769  .namespaceZero = true,
9770  .padding = offsetof(UA_WriteResponse, diagnosticInfosSize) - offsetof(UA_WriteResponse, results) - sizeof(void*),
9771  .isArray = true
9772  },};
9773 
9774 /* BrowseNextRequest */
9775 static UA_DataTypeMember BrowseNextRequest_members[3] = {
9777 #ifdef UA_ENABLE_TYPENAMES
9778  .memberName = "requestHeader",
9779 #endif
9780  .namespaceZero = true,
9781  .padding = 0,
9782  .isArray = false
9783  },
9784  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9785 #ifdef UA_ENABLE_TYPENAMES
9786  .memberName = "releaseContinuationPoints",
9787 #endif
9788  .namespaceZero = true,
9789  .padding = offsetof(UA_BrowseNextRequest, releaseContinuationPoints) - offsetof(UA_BrowseNextRequest, requestHeader) - sizeof(UA_RequestHeader),
9790  .isArray = false
9791  },
9792  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9793 #ifdef UA_ENABLE_TYPENAMES
9794  .memberName = "continuationPoints",
9795 #endif
9796  .namespaceZero = true,
9797  .padding = offsetof(UA_BrowseNextRequest, continuationPointsSize) - offsetof(UA_BrowseNextRequest, releaseContinuationPoints) - sizeof(UA_Boolean),
9798  .isArray = true
9799  },};
9800 
9801 /* CreateSubscriptionRequest */
9802 static UA_DataTypeMember CreateSubscriptionRequest_members[7] = {
9804 #ifdef UA_ENABLE_TYPENAMES
9805  .memberName = "requestHeader",
9806 #endif
9807  .namespaceZero = true,
9808  .padding = 0,
9809  .isArray = false
9810  },
9811  { .memberTypeIndex = UA_TYPES_DOUBLE,
9812 #ifdef UA_ENABLE_TYPENAMES
9813  .memberName = "requestedPublishingInterval",
9814 #endif
9815  .namespaceZero = true,
9816  .padding = offsetof(UA_CreateSubscriptionRequest, requestedPublishingInterval) - offsetof(UA_CreateSubscriptionRequest, requestHeader) - sizeof(UA_RequestHeader),
9817  .isArray = false
9818  },
9819  { .memberTypeIndex = UA_TYPES_UINT32,
9820 #ifdef UA_ENABLE_TYPENAMES
9821  .memberName = "requestedLifetimeCount",
9822 #endif
9823  .namespaceZero = true,
9824  .padding = offsetof(UA_CreateSubscriptionRequest, requestedLifetimeCount) - offsetof(UA_CreateSubscriptionRequest, requestedPublishingInterval) - sizeof(UA_Double),
9825  .isArray = false
9826  },
9827  { .memberTypeIndex = UA_TYPES_UINT32,
9828 #ifdef UA_ENABLE_TYPENAMES
9829  .memberName = "requestedMaxKeepAliveCount",
9830 #endif
9831  .namespaceZero = true,
9832  .padding = offsetof(UA_CreateSubscriptionRequest, requestedMaxKeepAliveCount) - offsetof(UA_CreateSubscriptionRequest, requestedLifetimeCount) - sizeof(UA_UInt32),
9833  .isArray = false
9834  },
9835  { .memberTypeIndex = UA_TYPES_UINT32,
9836 #ifdef UA_ENABLE_TYPENAMES
9837  .memberName = "maxNotificationsPerPublish",
9838 #endif
9839  .namespaceZero = true,
9840  .padding = offsetof(UA_CreateSubscriptionRequest, maxNotificationsPerPublish) - offsetof(UA_CreateSubscriptionRequest, requestedMaxKeepAliveCount) - sizeof(UA_UInt32),
9841  .isArray = false
9842  },
9843  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9844 #ifdef UA_ENABLE_TYPENAMES
9845  .memberName = "publishingEnabled",
9846 #endif
9847  .namespaceZero = true,
9848  .padding = offsetof(UA_CreateSubscriptionRequest, publishingEnabled) - offsetof(UA_CreateSubscriptionRequest, maxNotificationsPerPublish) - sizeof(UA_UInt32),
9849  .isArray = false
9850  },
9851  { .memberTypeIndex = UA_TYPES_BYTE,
9852 #ifdef UA_ENABLE_TYPENAMES
9853  .memberName = "priority",
9854 #endif
9855  .namespaceZero = true,
9856  .padding = offsetof(UA_CreateSubscriptionRequest, priority) - offsetof(UA_CreateSubscriptionRequest, publishingEnabled) - sizeof(UA_Boolean),
9857  .isArray = false
9858  },};
9859 
9860 /* VariableTypeAttributes */
9861 static UA_DataTypeMember VariableTypeAttributes_members[10] = {
9863 #ifdef UA_ENABLE_TYPENAMES
9864  .memberName = "specifiedAttributes",
9865 #endif
9866  .namespaceZero = true,
9867  .padding = 0,
9868  .isArray = false
9869  },
9870  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9871 #ifdef UA_ENABLE_TYPENAMES
9872  .memberName = "displayName",
9873 #endif
9874  .namespaceZero = true,
9875  .padding = offsetof(UA_VariableTypeAttributes, displayName) - offsetof(UA_VariableTypeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
9876  .isArray = false
9877  },
9878  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9879 #ifdef UA_ENABLE_TYPENAMES
9880  .memberName = "description",
9881 #endif
9882  .namespaceZero = true,
9883  .padding = offsetof(UA_VariableTypeAttributes, description) - offsetof(UA_VariableTypeAttributes, displayName) - sizeof(UA_LocalizedText),
9884  .isArray = false
9885  },
9886  { .memberTypeIndex = UA_TYPES_UINT32,
9887 #ifdef UA_ENABLE_TYPENAMES
9888  .memberName = "writeMask",
9889 #endif
9890  .namespaceZero = true,
9891  .padding = offsetof(UA_VariableTypeAttributes, writeMask) - offsetof(UA_VariableTypeAttributes, description) - sizeof(UA_LocalizedText),
9892  .isArray = false
9893  },
9894  { .memberTypeIndex = UA_TYPES_UINT32,
9895 #ifdef UA_ENABLE_TYPENAMES
9896  .memberName = "userWriteMask",
9897 #endif
9898  .namespaceZero = true,
9899  .padding = offsetof(UA_VariableTypeAttributes, userWriteMask) - offsetof(UA_VariableTypeAttributes, writeMask) - sizeof(UA_UInt32),
9900  .isArray = false
9901  },
9902  { .memberTypeIndex = UA_TYPES_VARIANT,
9903 #ifdef UA_ENABLE_TYPENAMES
9904  .memberName = "value",
9905 #endif
9906  .namespaceZero = true,
9907  .padding = offsetof(UA_VariableTypeAttributes, value) - offsetof(UA_VariableTypeAttributes, userWriteMask) - sizeof(UA_UInt32),
9908  .isArray = false
9909  },
9910  { .memberTypeIndex = UA_TYPES_NODEID,
9911 #ifdef UA_ENABLE_TYPENAMES
9912  .memberName = "dataType",
9913 #endif
9914  .namespaceZero = true,
9915  .padding = offsetof(UA_VariableTypeAttributes, dataType) - offsetof(UA_VariableTypeAttributes, value) - sizeof(UA_Variant),
9916  .isArray = false
9917  },
9918  { .memberTypeIndex = UA_TYPES_INT32,
9919 #ifdef UA_ENABLE_TYPENAMES
9920  .memberName = "valueRank",
9921 #endif
9922  .namespaceZero = true,
9923  .padding = offsetof(UA_VariableTypeAttributes, valueRank) - offsetof(UA_VariableTypeAttributes, dataType) - sizeof(UA_NodeId),
9924  .isArray = false
9925  },
9926  { .memberTypeIndex = UA_TYPES_UINT32,
9927 #ifdef UA_ENABLE_TYPENAMES
9928  .memberName = "arrayDimensions",
9929 #endif
9930  .namespaceZero = true,
9931  .padding = offsetof(UA_VariableTypeAttributes, arrayDimensionsSize) - offsetof(UA_VariableTypeAttributes, valueRank) - sizeof(UA_Int32),
9932  .isArray = true
9933  },
9934  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9935 #ifdef UA_ENABLE_TYPENAMES
9936  .memberName = "isAbstract",
9937 #endif
9938  .namespaceZero = true,
9939  .padding = offsetof(UA_VariableTypeAttributes, isAbstract) - offsetof(UA_VariableTypeAttributes, arrayDimensions) - sizeof(void*),
9940  .isArray = false
9941  },};
9942 
9943 /* BrowsePathResult */
9944 static UA_DataTypeMember BrowsePathResult_members[2] = {
9946 #ifdef UA_ENABLE_TYPENAMES
9947  .memberName = "statusCode",
9948 #endif
9949  .namespaceZero = true,
9950  .padding = 0,
9951  .isArray = false
9952  },
9953  { .memberTypeIndex = UA_TYPES_BROWSEPATHTARGET,
9954 #ifdef UA_ENABLE_TYPENAMES
9955  .memberName = "targets",
9956 #endif
9957  .namespaceZero = true,
9958  .padding = offsetof(UA_BrowsePathResult, targetsSize) - offsetof(UA_BrowsePathResult, statusCode) - sizeof(UA_StatusCode),
9959  .isArray = true
9960  },};
9961 
9962 /* ModifySubscriptionResponse */
9963 static UA_DataTypeMember ModifySubscriptionResponse_members[4] = {
9965 #ifdef UA_ENABLE_TYPENAMES
9966  .memberName = "responseHeader",
9967 #endif
9968  .namespaceZero = true,
9969  .padding = 0,
9970  .isArray = false
9971  },
9972  { .memberTypeIndex = UA_TYPES_DOUBLE,
9973 #ifdef UA_ENABLE_TYPENAMES
9974  .memberName = "revisedPublishingInterval",
9975 #endif
9976  .namespaceZero = true,
9977  .padding = offsetof(UA_ModifySubscriptionResponse, revisedPublishingInterval) - offsetof(UA_ModifySubscriptionResponse, responseHeader) - sizeof(UA_ResponseHeader),
9978  .isArray = false
9979  },
9980  { .memberTypeIndex = UA_TYPES_UINT32,
9981 #ifdef UA_ENABLE_TYPENAMES
9982  .memberName = "revisedLifetimeCount",
9983 #endif
9984  .namespaceZero = true,
9985  .padding = offsetof(UA_ModifySubscriptionResponse, revisedLifetimeCount) - offsetof(UA_ModifySubscriptionResponse, revisedPublishingInterval) - sizeof(UA_Double),
9986  .isArray = false
9987  },
9988  { .memberTypeIndex = UA_TYPES_UINT32,
9989 #ifdef UA_ENABLE_TYPENAMES
9990  .memberName = "revisedMaxKeepAliveCount",
9991 #endif
9992  .namespaceZero = true,
9993  .padding = offsetof(UA_ModifySubscriptionResponse, revisedMaxKeepAliveCount) - offsetof(UA_ModifySubscriptionResponse, revisedLifetimeCount) - sizeof(UA_UInt32),
9994  .isArray = false
9995  },};
9996 
9997 /* OpenSecureChannelRequest */
9998 static UA_DataTypeMember OpenSecureChannelRequest_members[6] = {
10000 #ifdef UA_ENABLE_TYPENAMES
10001  .memberName = "requestHeader",
10002 #endif
10003  .namespaceZero = true,
10004  .padding = 0,
10005  .isArray = false
10006  },
10007  { .memberTypeIndex = UA_TYPES_UINT32,
10008 #ifdef UA_ENABLE_TYPENAMES
10009  .memberName = "clientProtocolVersion",
10010 #endif
10011  .namespaceZero = true,
10012  .padding = offsetof(UA_OpenSecureChannelRequest, clientProtocolVersion) - offsetof(UA_OpenSecureChannelRequest, requestHeader) - sizeof(UA_RequestHeader),
10013  .isArray = false
10014  },
10015  { .memberTypeIndex = UA_TYPES_SECURITYTOKENREQUESTTYPE,
10016 #ifdef UA_ENABLE_TYPENAMES
10017  .memberName = "requestType",
10018 #endif
10019  .namespaceZero = true,
10020  .padding = offsetof(UA_OpenSecureChannelRequest, requestType) - offsetof(UA_OpenSecureChannelRequest, clientProtocolVersion) - sizeof(UA_UInt32),
10021  .isArray = false
10022  },
10023  { .memberTypeIndex = UA_TYPES_MESSAGESECURITYMODE,
10024 #ifdef UA_ENABLE_TYPENAMES
10025  .memberName = "securityMode",
10026 #endif
10027  .namespaceZero = true,
10028  .padding = offsetof(UA_OpenSecureChannelRequest, securityMode) - offsetof(UA_OpenSecureChannelRequest, requestType) - sizeof(UA_SecurityTokenRequestType),
10029  .isArray = false
10030  },
10031  { .memberTypeIndex = UA_TYPES_BYTESTRING,
10032 #ifdef UA_ENABLE_TYPENAMES
10033  .memberName = "clientNonce",
10034 #endif
10035  .namespaceZero = true,
10036  .padding = offsetof(UA_OpenSecureChannelRequest, clientNonce) - offsetof(UA_OpenSecureChannelRequest, securityMode) - sizeof(UA_MessageSecurityMode),
10037  .isArray = false
10038  },
10039  { .memberTypeIndex = UA_TYPES_UINT32,
10040 #ifdef UA_ENABLE_TYPENAMES
10041  .memberName = "requestedLifetime",
10042 #endif
10043  .namespaceZero = true,
10044  .padding = offsetof(UA_OpenSecureChannelRequest, requestedLifetime) - offsetof(UA_OpenSecureChannelRequest, clientNonce) - sizeof(UA_ByteString),
10045  .isArray = false
10046  },};
10047 
10048 /* RegisterNodesResponse */
10049 static UA_DataTypeMember RegisterNodesResponse_members[2] = {
10051 #ifdef UA_ENABLE_TYPENAMES
10052  .memberName = "responseHeader",
10053 #endif
10054  .namespaceZero = true,
10055  .padding = 0,
10056  .isArray = false
10057  },
10058  { .memberTypeIndex = UA_TYPES_NODEID,
10059 #ifdef UA_ENABLE_TYPENAMES
10060  .memberName = "registeredNodeIds",
10061 #endif
10062  .namespaceZero = true,
10063  .padding = offsetof(UA_RegisterNodesResponse, registeredNodeIdsSize) - offsetof(UA_RegisterNodesResponse, responseHeader) - sizeof(UA_ResponseHeader),
10064  .isArray = true
10065  },};
10066 
10067 /* CloseSessionRequest */
10068 static UA_DataTypeMember CloseSessionRequest_members[2] = {
10070 #ifdef UA_ENABLE_TYPENAMES
10071  .memberName = "requestHeader",
10072 #endif
10073  .namespaceZero = true,
10074  .padding = 0,
10075  .isArray = false
10076  },
10077  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10078 #ifdef UA_ENABLE_TYPENAMES
10079  .memberName = "deleteSubscriptions",
10080 #endif
10081  .namespaceZero = true,
10082  .padding = offsetof(UA_CloseSessionRequest, deleteSubscriptions) - offsetof(UA_CloseSessionRequest, requestHeader) - sizeof(UA_RequestHeader),
10083  .isArray = false
10084  },};
10085 
10086 /* ModifySubscriptionRequest */
10087 static UA_DataTypeMember ModifySubscriptionRequest_members[7] = {
10089 #ifdef UA_ENABLE_TYPENAMES
10090  .memberName = "requestHeader",
10091 #endif
10092  .namespaceZero = true,
10093  .padding = 0,
10094  .isArray = false
10095  },
10096  { .memberTypeIndex = UA_TYPES_UINT32,
10097 #ifdef UA_ENABLE_TYPENAMES
10098  .memberName = "subscriptionId",
10099 #endif
10100  .namespaceZero = true,
10101  .padding = offsetof(UA_ModifySubscriptionRequest, subscriptionId) - offsetof(UA_ModifySubscriptionRequest, requestHeader) - sizeof(UA_RequestHeader),
10102  .isArray = false
10103  },
10104  { .memberTypeIndex = UA_TYPES_DOUBLE,
10105 #ifdef UA_ENABLE_TYPENAMES
10106  .memberName = "requestedPublishingInterval",
10107 #endif
10108  .namespaceZero = true,
10109  .padding = offsetof(UA_ModifySubscriptionRequest, requestedPublishingInterval) - offsetof(UA_ModifySubscriptionRequest, subscriptionId) - sizeof(UA_UInt32),
10110  .isArray = false
10111  },
10112  { .memberTypeIndex = UA_TYPES_UINT32,
10113 #ifdef UA_ENABLE_TYPENAMES
10114  .memberName = "requestedLifetimeCount",
10115 #endif
10116  .namespaceZero = true,
10117  .padding = offsetof(UA_ModifySubscriptionRequest, requestedLifetimeCount) - offsetof(UA_ModifySubscriptionRequest, requestedPublishingInterval) - sizeof(UA_Double),
10118  .isArray = false
10119  },
10120  { .memberTypeIndex = UA_TYPES_UINT32,
10121 #ifdef UA_ENABLE_TYPENAMES
10122  .memberName = "requestedMaxKeepAliveCount",
10123 #endif
10124  .namespaceZero = true,
10125  .padding = offsetof(UA_ModifySubscriptionRequest, requestedMaxKeepAliveCount) - offsetof(UA_ModifySubscriptionRequest, requestedLifetimeCount) - sizeof(UA_UInt32),
10126  .isArray = false
10127  },
10128  { .memberTypeIndex = UA_TYPES_UINT32,
10129 #ifdef UA_ENABLE_TYPENAMES
10130  .memberName = "maxNotificationsPerPublish",
10131 #endif
10132  .namespaceZero = true,
10133  .padding = offsetof(UA_ModifySubscriptionRequest, maxNotificationsPerPublish) - offsetof(UA_ModifySubscriptionRequest, requestedMaxKeepAliveCount) - sizeof(UA_UInt32),
10134  .isArray = false
10135  },
10136  { .memberTypeIndex = UA_TYPES_BYTE,
10137 #ifdef UA_ENABLE_TYPENAMES
10138  .memberName = "priority",
10139 #endif
10140  .namespaceZero = true,
10141  .padding = offsetof(UA_ModifySubscriptionRequest, priority) - offsetof(UA_ModifySubscriptionRequest, maxNotificationsPerPublish) - sizeof(UA_UInt32),
10142  .isArray = false
10143  },};
10144 
10145 /* UserTokenPolicy */
10146 static UA_DataTypeMember UserTokenPolicy_members[5] = {
10148 #ifdef UA_ENABLE_TYPENAMES
10149  .memberName = "policyId",
10150 #endif
10151  .namespaceZero = true,
10152  .padding = 0,
10153  .isArray = false
10154  },
10155  { .memberTypeIndex = UA_TYPES_USERTOKENTYPE,
10156 #ifdef UA_ENABLE_TYPENAMES
10157  .memberName = "tokenType",
10158 #endif
10159  .namespaceZero = true,
10160  .padding = offsetof(UA_UserTokenPolicy, tokenType) - offsetof(UA_UserTokenPolicy, policyId) - sizeof(UA_String),
10161  .isArray = false
10162  },
10163  { .memberTypeIndex = UA_TYPES_STRING,
10164 #ifdef UA_ENABLE_TYPENAMES
10165  .memberName = "issuedTokenType",
10166 #endif
10167  .namespaceZero = true,
10168  .padding = offsetof(UA_UserTokenPolicy, issuedTokenType) - offsetof(UA_UserTokenPolicy, tokenType) - sizeof(UA_UserTokenType),
10169  .isArray = false
10170  },
10171  { .memberTypeIndex = UA_TYPES_STRING,
10172 #ifdef UA_ENABLE_TYPENAMES
10173  .memberName = "issuerEndpointUrl",
10174 #endif
10175  .namespaceZero = true,
10176  .padding = offsetof(UA_UserTokenPolicy, issuerEndpointUrl) - offsetof(UA_UserTokenPolicy, issuedTokenType) - sizeof(UA_String),
10177  .isArray = false
10178  },
10179  { .memberTypeIndex = UA_TYPES_STRING,
10180 #ifdef UA_ENABLE_TYPENAMES
10181  .memberName = "securityPolicyUri",
10182 #endif
10183  .namespaceZero = true,
10184  .padding = offsetof(UA_UserTokenPolicy, securityPolicyUri) - offsetof(UA_UserTokenPolicy, issuerEndpointUrl) - sizeof(UA_String),
10185  .isArray = false
10186  },};
10187 
10188 /* DeleteMonitoredItemsRequest */
10189 static UA_DataTypeMember DeleteMonitoredItemsRequest_members[3] = {
10191 #ifdef UA_ENABLE_TYPENAMES
10192  .memberName = "requestHeader",
10193 #endif
10194  .namespaceZero = true,
10195  .padding = 0,
10196  .isArray = false
10197  },
10198  { .memberTypeIndex = UA_TYPES_UINT32,
10199 #ifdef UA_ENABLE_TYPENAMES
10200  .memberName = "subscriptionId",
10201 #endif
10202  .namespaceZero = true,
10203  .padding = offsetof(UA_DeleteMonitoredItemsRequest, subscriptionId) - offsetof(UA_DeleteMonitoredItemsRequest, requestHeader) - sizeof(UA_RequestHeader),
10204  .isArray = false
10205  },
10206  { .memberTypeIndex = UA_TYPES_UINT32,
10207 #ifdef UA_ENABLE_TYPENAMES
10208  .memberName = "monitoredItemIds",
10209 #endif
10210  .namespaceZero = true,
10211  .padding = offsetof(UA_DeleteMonitoredItemsRequest, monitoredItemIdsSize) - offsetof(UA_DeleteMonitoredItemsRequest, subscriptionId) - sizeof(UA_UInt32),
10212  .isArray = true
10213  },};
10214 
10215 /* ReferenceTypeAttributes */
10216 static UA_DataTypeMember ReferenceTypeAttributes_members[8] = {
10218 #ifdef UA_ENABLE_TYPENAMES
10219  .memberName = "specifiedAttributes",
10220 #endif
10221  .namespaceZero = true,
10222  .padding = 0,
10223  .isArray = false
10224  },
10225  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10226 #ifdef UA_ENABLE_TYPENAMES
10227  .memberName = "displayName",
10228 #endif
10229  .namespaceZero = true,
10230  .padding = offsetof(UA_ReferenceTypeAttributes, displayName) - offsetof(UA_ReferenceTypeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
10231  .isArray = false
10232  },
10233  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10234 #ifdef UA_ENABLE_TYPENAMES
10235  .memberName = "description",
10236 #endif
10237  .namespaceZero = true,
10238  .padding = offsetof(UA_ReferenceTypeAttributes, description) - offsetof(UA_ReferenceTypeAttributes, displayName) - sizeof(UA_LocalizedText),
10239  .isArray = false
10240  },
10241  { .memberTypeIndex = UA_TYPES_UINT32,
10242 #ifdef UA_ENABLE_TYPENAMES
10243  .memberName = "writeMask",
10244 #endif
10245  .namespaceZero = true,
10246  .padding = offsetof(UA_ReferenceTypeAttributes, writeMask) - offsetof(UA_ReferenceTypeAttributes, description) - sizeof(UA_LocalizedText),
10247  .isArray = false
10248  },
10249  { .memberTypeIndex = UA_TYPES_UINT32,
10250 #ifdef UA_ENABLE_TYPENAMES
10251  .memberName = "userWriteMask",
10252 #endif
10253  .namespaceZero = true,
10254  .padding = offsetof(UA_ReferenceTypeAttributes, userWriteMask) - offsetof(UA_ReferenceTypeAttributes, writeMask) - sizeof(UA_UInt32),
10255  .isArray = false
10256  },
10257  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10258 #ifdef UA_ENABLE_TYPENAMES
10259  .memberName = "isAbstract",
10260 #endif
10261  .namespaceZero = true,
10262  .padding = offsetof(UA_ReferenceTypeAttributes, isAbstract) - offsetof(UA_ReferenceTypeAttributes, userWriteMask) - sizeof(UA_UInt32),
10263  .isArray = false
10264  },
10265  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10266 #ifdef UA_ENABLE_TYPENAMES
10267  .memberName = "symmetric",
10268 #endif
10269  .namespaceZero = true,
10270  .padding = offsetof(UA_ReferenceTypeAttributes, symmetric) - offsetof(UA_ReferenceTypeAttributes, isAbstract) - sizeof(UA_Boolean),
10271  .isArray = false
10272  },
10273  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10274 #ifdef UA_ENABLE_TYPENAMES
10275  .memberName = "inverseName",
10276 #endif
10277  .namespaceZero = true,
10278  .padding = offsetof(UA_ReferenceTypeAttributes, inverseName) - offsetof(UA_ReferenceTypeAttributes, symmetric) - sizeof(UA_Boolean),
10279  .isArray = false
10280  },};
10281 
10282 /* SetMonitoringModeRequest */
10283 static UA_DataTypeMember SetMonitoringModeRequest_members[4] = {
10285 #ifdef UA_ENABLE_TYPENAMES
10286  .memberName = "requestHeader",
10287 #endif
10288  .namespaceZero = true,
10289  .padding = 0,
10290  .isArray = false
10291  },
10292  { .memberTypeIndex = UA_TYPES_UINT32,
10293 #ifdef UA_ENABLE_TYPENAMES
10294  .memberName = "subscriptionId",
10295 #endif
10296  .namespaceZero = true,
10297  .padding = offsetof(UA_SetMonitoringModeRequest, subscriptionId) - offsetof(UA_SetMonitoringModeRequest, requestHeader) - sizeof(UA_RequestHeader),
10298  .isArray = false
10299  },
10300  { .memberTypeIndex = UA_TYPES_MONITORINGMODE,
10301 #ifdef UA_ENABLE_TYPENAMES
10302  .memberName = "monitoringMode",
10303 #endif
10304  .namespaceZero = true,
10305  .padding = offsetof(UA_SetMonitoringModeRequest, monitoringMode) - offsetof(UA_SetMonitoringModeRequest, subscriptionId) - sizeof(UA_UInt32),
10306  .isArray = false
10307  },
10308  { .memberTypeIndex = UA_TYPES_UINT32,
10309 #ifdef UA_ENABLE_TYPENAMES
10310  .memberName = "monitoredItemIds",
10311 #endif
10312  .namespaceZero = true,
10313  .padding = offsetof(UA_SetMonitoringModeRequest, monitoredItemIdsSize) - offsetof(UA_SetMonitoringModeRequest, monitoringMode) - sizeof(UA_MonitoringMode),
10314  .isArray = true
10315  },};
10316 
10317 /* UnregisterNodesResponse */
10318 static UA_DataTypeMember UnregisterNodesResponse_members[1] = {
10320 #ifdef UA_ENABLE_TYPENAMES
10321  .memberName = "responseHeader",
10322 #endif
10323  .namespaceZero = true,
10324  .padding = 0,
10325  .isArray = false
10326  },};
10327 
10328 /* WriteRequest */
10329 static UA_DataTypeMember WriteRequest_members[2] = {
10331 #ifdef UA_ENABLE_TYPENAMES
10332  .memberName = "requestHeader",
10333 #endif
10334  .namespaceZero = true,
10335  .padding = 0,
10336  .isArray = false
10337  },
10338  { .memberTypeIndex = UA_TYPES_WRITEVALUE,
10339 #ifdef UA_ENABLE_TYPENAMES
10340  .memberName = "nodesToWrite",
10341 #endif
10342  .namespaceZero = true,
10343  .padding = offsetof(UA_WriteRequest, nodesToWriteSize) - offsetof(UA_WriteRequest, requestHeader) - sizeof(UA_RequestHeader),
10344  .isArray = true
10345  },};
10346 
10347 /* ObjectAttributes */
10348 static UA_DataTypeMember ObjectAttributes_members[6] = {
10350 #ifdef UA_ENABLE_TYPENAMES
10351  .memberName = "specifiedAttributes",
10352 #endif
10353  .namespaceZero = true,
10354  .padding = 0,
10355  .isArray = false
10356  },
10357  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10358 #ifdef UA_ENABLE_TYPENAMES
10359  .memberName = "displayName",
10360 #endif
10361  .namespaceZero = true,
10362  .padding = offsetof(UA_ObjectAttributes, displayName) - offsetof(UA_ObjectAttributes, specifiedAttributes) - sizeof(UA_UInt32),
10363  .isArray = false
10364  },
10365  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10366 #ifdef UA_ENABLE_TYPENAMES
10367  .memberName = "description",
10368 #endif
10369  .namespaceZero = true,
10370  .padding = offsetof(UA_ObjectAttributes, description) - offsetof(UA_ObjectAttributes, displayName) - sizeof(UA_LocalizedText),
10371  .isArray = false
10372  },
10373  { .memberTypeIndex = UA_TYPES_UINT32,
10374 #ifdef UA_ENABLE_TYPENAMES
10375  .memberName = "writeMask",
10376 #endif
10377  .namespaceZero = true,
10378  .padding = offsetof(UA_ObjectAttributes, writeMask) - offsetof(UA_ObjectAttributes, description) - sizeof(UA_LocalizedText),
10379  .isArray = false
10380  },
10381  { .memberTypeIndex = UA_TYPES_UINT32,
10382 #ifdef UA_ENABLE_TYPENAMES
10383  .memberName = "userWriteMask",
10384 #endif
10385  .namespaceZero = true,
10386  .padding = offsetof(UA_ObjectAttributes, userWriteMask) - offsetof(UA_ObjectAttributes, writeMask) - sizeof(UA_UInt32),
10387  .isArray = false
10388  },
10389  { .memberTypeIndex = UA_TYPES_BYTE,
10390 #ifdef UA_ENABLE_TYPENAMES
10391  .memberName = "eventNotifier",
10392 #endif
10393  .namespaceZero = true,
10394  .padding = offsetof(UA_ObjectAttributes, eventNotifier) - offsetof(UA_ObjectAttributes, userWriteMask) - sizeof(UA_UInt32),
10395  .isArray = false
10396  },};
10397 
10398 /* BrowseDescription */
10399 static UA_DataTypeMember BrowseDescription_members[6] = {
10401 #ifdef UA_ENABLE_TYPENAMES
10402  .memberName = "nodeId",
10403 #endif
10404  .namespaceZero = true,
10405  .padding = 0,
10406  .isArray = false
10407  },
10408  { .memberTypeIndex = UA_TYPES_BROWSEDIRECTION,
10409 #ifdef UA_ENABLE_TYPENAMES
10410  .memberName = "browseDirection",
10411 #endif
10412  .namespaceZero = true,
10413  .padding = offsetof(UA_BrowseDescription, browseDirection) - offsetof(UA_BrowseDescription, nodeId) - sizeof(UA_NodeId),
10414  .isArray = false
10415  },
10416  { .memberTypeIndex = UA_TYPES_NODEID,
10417 #ifdef UA_ENABLE_TYPENAMES
10418  .memberName = "referenceTypeId",
10419 #endif
10420  .namespaceZero = true,
10421  .padding = offsetof(UA_BrowseDescription, referenceTypeId) - offsetof(UA_BrowseDescription, browseDirection) - sizeof(UA_BrowseDirection),
10422  .isArray = false
10423  },
10424  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10425 #ifdef UA_ENABLE_TYPENAMES
10426  .memberName = "includeSubtypes",
10427 #endif
10428  .namespaceZero = true,
10429  .padding = offsetof(UA_BrowseDescription, includeSubtypes) - offsetof(UA_BrowseDescription, referenceTypeId) - sizeof(UA_NodeId),
10430  .isArray = false
10431  },
10432  { .memberTypeIndex = UA_TYPES_UINT32,
10433 #ifdef UA_ENABLE_TYPENAMES
10434  .memberName = "nodeClassMask",
10435 #endif
10436  .namespaceZero = true,
10437  .padding = offsetof(UA_BrowseDescription, nodeClassMask) - offsetof(UA_BrowseDescription, includeSubtypes) - sizeof(UA_Boolean),
10438  .isArray = false
10439  },
10440  { .memberTypeIndex = UA_TYPES_UINT32,
10441 #ifdef UA_ENABLE_TYPENAMES
10442  .memberName = "resultMask",
10443 #endif
10444  .namespaceZero = true,
10445  .padding = offsetof(UA_BrowseDescription, resultMask) - offsetof(UA_BrowseDescription, nodeClassMask) - sizeof(UA_UInt32),
10446  .isArray = false
10447  },};
10448 
10449 /* RepublishRequest */
10450 static UA_DataTypeMember RepublishRequest_members[3] = {
10452 #ifdef UA_ENABLE_TYPENAMES
10453  .memberName = "requestHeader",
10454 #endif
10455  .namespaceZero = true,
10456  .padding = 0,
10457  .isArray = false
10458  },
10459  { .memberTypeIndex = UA_TYPES_UINT32,
10460 #ifdef UA_ENABLE_TYPENAMES
10461  .memberName = "subscriptionId",
10462 #endif
10463  .namespaceZero = true,
10464  .padding = offsetof(UA_RepublishRequest, subscriptionId) - offsetof(UA_RepublishRequest, requestHeader) - sizeof(UA_RequestHeader),
10465  .isArray = false
10466  },
10467  { .memberTypeIndex = UA_TYPES_UINT32,
10468 #ifdef UA_ENABLE_TYPENAMES
10469  .memberName = "retransmitSequenceNumber",
10470 #endif
10471  .namespaceZero = true,
10472  .padding = offsetof(UA_RepublishRequest, retransmitSequenceNumber) - offsetof(UA_RepublishRequest, subscriptionId) - sizeof(UA_UInt32),
10473  .isArray = false
10474  },};
10475 
10476 /* GetEndpointsRequest */
10477 static UA_DataTypeMember GetEndpointsRequest_members[4] = {
10479 #ifdef UA_ENABLE_TYPENAMES
10480  .memberName = "requestHeader",
10481 #endif
10482  .namespaceZero = true,
10483  .padding = 0,
10484  .isArray = false
10485  },
10486  { .memberTypeIndex = UA_TYPES_STRING,
10487 #ifdef UA_ENABLE_TYPENAMES
10488  .memberName = "endpointUrl",
10489 #endif
10490  .namespaceZero = true,
10491  .padding = offsetof(UA_GetEndpointsRequest, endpointUrl) - offsetof(UA_GetEndpointsRequest, requestHeader) - sizeof(UA_RequestHeader),
10492  .isArray = false
10493  },
10494  { .memberTypeIndex = UA_TYPES_STRING,
10495 #ifdef UA_ENABLE_TYPENAMES
10496  .memberName = "localeIds",
10497 #endif
10498  .namespaceZero = true,
10499  .padding = offsetof(UA_GetEndpointsRequest, localeIdsSize) - offsetof(UA_GetEndpointsRequest, endpointUrl) - sizeof(UA_String),
10500  .isArray = true
10501  },
10502  { .memberTypeIndex = UA_TYPES_STRING,
10503 #ifdef UA_ENABLE_TYPENAMES
10504  .memberName = "profileUris",
10505 #endif
10506  .namespaceZero = true,
10507  .padding = offsetof(UA_GetEndpointsRequest, profileUrisSize) - offsetof(UA_GetEndpointsRequest, localeIds) - sizeof(void*),
10508  .isArray = true
10509  },};
10510 
10511 /* PublishRequest */
10512 static UA_DataTypeMember PublishRequest_members[2] = {
10514 #ifdef UA_ENABLE_TYPENAMES
10515  .memberName = "requestHeader",
10516 #endif
10517  .namespaceZero = true,
10518  .padding = 0,
10519  .isArray = false
10520  },
10521  { .memberTypeIndex = UA_TYPES_SUBSCRIPTIONACKNOWLEDGEMENT,
10522 #ifdef UA_ENABLE_TYPENAMES
10523  .memberName = "subscriptionAcknowledgements",
10524 #endif
10525  .namespaceZero = true,
10526  .padding = offsetof(UA_PublishRequest, subscriptionAcknowledgementsSize) - offsetof(UA_PublishRequest, requestHeader) - sizeof(UA_RequestHeader),
10527  .isArray = true
10528  },};
10529 
10530 /* AddNodesResponse */
10531 static UA_DataTypeMember AddNodesResponse_members[3] = {
10533 #ifdef UA_ENABLE_TYPENAMES
10534  .memberName = "responseHeader",
10535 #endif
10536  .namespaceZero = true,
10537  .padding = 0,
10538  .isArray = false
10539  },
10540  { .memberTypeIndex = UA_TYPES_ADDNODESRESULT,
10541 #ifdef UA_ENABLE_TYPENAMES
10542  .memberName = "results",
10543 #endif
10544  .namespaceZero = true,
10545  .padding = offsetof(UA_AddNodesResponse, resultsSize) - offsetof(UA_AddNodesResponse, responseHeader) - sizeof(UA_ResponseHeader),
10546  .isArray = true
10547  },
10548  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10549 #ifdef UA_ENABLE_TYPENAMES
10550  .memberName = "diagnosticInfos",
10551 #endif
10552  .namespaceZero = true,
10553  .padding = offsetof(UA_AddNodesResponse, diagnosticInfosSize) - offsetof(UA_AddNodesResponse, results) - sizeof(void*),
10554  .isArray = true
10555  },};
10556 
10557 /* DataChangeNotification */
10558 static UA_DataTypeMember DataChangeNotification_members[2] = {
10560 #ifdef UA_ENABLE_TYPENAMES
10561  .memberName = "monitoredItems",
10562 #endif
10563  .namespaceZero = true,
10564  .padding = 0,
10565  .isArray = true
10566  },
10567  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10568 #ifdef UA_ENABLE_TYPENAMES
10569  .memberName = "diagnosticInfos",
10570 #endif
10571  .namespaceZero = true,
10572  .padding = offsetof(UA_DataChangeNotification, diagnosticInfosSize) - offsetof(UA_DataChangeNotification, monitoredItems) - sizeof(void*),
10573  .isArray = true
10574  },};
10575 
10576 /* CloseSecureChannelResponse */
10577 static UA_DataTypeMember CloseSecureChannelResponse_members[1] = {
10579 #ifdef UA_ENABLE_TYPENAMES
10580  .memberName = "responseHeader",
10581 #endif
10582  .namespaceZero = true,
10583  .padding = 0,
10584  .isArray = false
10585  },};
10586 
10587 /* ModifyMonitoredItemsRequest */
10588 static UA_DataTypeMember ModifyMonitoredItemsRequest_members[4] = {
10590 #ifdef UA_ENABLE_TYPENAMES
10591  .memberName = "requestHeader",
10592 #endif
10593  .namespaceZero = true,
10594  .padding = 0,
10595  .isArray = false
10596  },
10597  { .memberTypeIndex = UA_TYPES_UINT32,
10598 #ifdef UA_ENABLE_TYPENAMES
10599  .memberName = "subscriptionId",
10600 #endif
10601  .namespaceZero = true,
10602  .padding = offsetof(UA_ModifyMonitoredItemsRequest, subscriptionId) - offsetof(UA_ModifyMonitoredItemsRequest, requestHeader) - sizeof(UA_RequestHeader),
10603  .isArray = false
10604  },
10605  { .memberTypeIndex = UA_TYPES_TIMESTAMPSTORETURN,
10606 #ifdef UA_ENABLE_TYPENAMES
10607  .memberName = "timestampsToReturn",
10608 #endif
10609  .namespaceZero = true,
10610  .padding = offsetof(UA_ModifyMonitoredItemsRequest, timestampsToReturn) - offsetof(UA_ModifyMonitoredItemsRequest, subscriptionId) - sizeof(UA_UInt32),
10611  .isArray = false
10612  },
10613  { .memberTypeIndex = UA_TYPES_MONITOREDITEMMODIFYREQUEST,
10614 #ifdef UA_ENABLE_TYPENAMES
10615  .memberName = "itemsToModify",
10616 #endif
10617  .namespaceZero = true,
10618  .padding = offsetof(UA_ModifyMonitoredItemsRequest, itemsToModifySize) - offsetof(UA_ModifyMonitoredItemsRequest, timestampsToReturn) - sizeof(UA_TimestampsToReturn),
10619  .isArray = true
10620  },};
10621 
10622 /* SetMonitoringModeResponse */
10623 static UA_DataTypeMember SetMonitoringModeResponse_members[3] = {
10625 #ifdef UA_ENABLE_TYPENAMES
10626  .memberName = "responseHeader",
10627 #endif
10628  .namespaceZero = true,
10629  .padding = 0,
10630  .isArray = false
10631  },
10632  { .memberTypeIndex = UA_TYPES_STATUSCODE,
10633 #ifdef UA_ENABLE_TYPENAMES
10634  .memberName = "results",
10635 #endif
10636  .namespaceZero = true,
10637  .padding = offsetof(UA_SetMonitoringModeResponse, resultsSize) - offsetof(UA_SetMonitoringModeResponse, responseHeader) - sizeof(UA_ResponseHeader),
10638  .isArray = true
10639  },
10640  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10641 #ifdef UA_ENABLE_TYPENAMES
10642  .memberName = "diagnosticInfos",
10643 #endif
10644  .namespaceZero = true,
10645  .padding = offsetof(UA_SetMonitoringModeResponse, diagnosticInfosSize) - offsetof(UA_SetMonitoringModeResponse, results) - sizeof(void*),
10646  .isArray = true
10647  },};
10648 
10649 /* FindServersRequest */
10650 static UA_DataTypeMember FindServersRequest_members[4] = {
10652 #ifdef UA_ENABLE_TYPENAMES
10653  .memberName = "requestHeader",
10654 #endif
10655  .namespaceZero = true,
10656  .padding = 0,
10657  .isArray = false
10658  },
10659  { .memberTypeIndex = UA_TYPES_STRING,
10660 #ifdef UA_ENABLE_TYPENAMES
10661  .memberName = "endpointUrl",
10662 #endif
10663  .namespaceZero = true,
10664  .padding = offsetof(UA_FindServersRequest, endpointUrl) - offsetof(UA_FindServersRequest, requestHeader) - sizeof(UA_RequestHeader),
10665  .isArray = false
10666  },
10667  { .memberTypeIndex = UA_TYPES_STRING,
10668 #ifdef UA_ENABLE_TYPENAMES
10669  .memberName = "localeIds",
10670 #endif
10671  .namespaceZero = true,
10672  .padding = offsetof(UA_FindServersRequest, localeIdsSize) - offsetof(UA_FindServersRequest, endpointUrl) - sizeof(UA_String),
10673  .isArray = true
10674  },
10675  { .memberTypeIndex = UA_TYPES_STRING,
10676 #ifdef UA_ENABLE_TYPENAMES
10677  .memberName = "serverUris",
10678 #endif
10679  .namespaceZero = true,
10680  .padding = offsetof(UA_FindServersRequest, serverUrisSize) - offsetof(UA_FindServersRequest, localeIds) - sizeof(void*),
10681  .isArray = true
10682  },};
10683 
10684 /* ReferenceDescription */
10685 static UA_DataTypeMember ReferenceDescription_members[7] = {
10687 #ifdef UA_ENABLE_TYPENAMES
10688  .memberName = "referenceTypeId",
10689 #endif
10690  .namespaceZero = true,
10691  .padding = 0,
10692  .isArray = false
10693  },
10694  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10695 #ifdef UA_ENABLE_TYPENAMES
10696  .memberName = "isForward",
10697 #endif
10698  .namespaceZero = true,
10699  .padding = offsetof(UA_ReferenceDescription, isForward) - offsetof(UA_ReferenceDescription, referenceTypeId) - sizeof(UA_NodeId),
10700  .isArray = false
10701  },
10702  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
10703 #ifdef UA_ENABLE_TYPENAMES
10704  .memberName = "nodeId",
10705 #endif
10706  .namespaceZero = true,
10707  .padding = offsetof(UA_ReferenceDescription, nodeId) - offsetof(UA_ReferenceDescription, isForward) - sizeof(UA_Boolean),
10708  .isArray = false
10709  },
10710  { .memberTypeIndex = UA_TYPES_QUALIFIEDNAME,
10711 #ifdef UA_ENABLE_TYPENAMES
10712  .memberName = "browseName",
10713 #endif
10714  .namespaceZero = true,
10715  .padding = offsetof(UA_ReferenceDescription, browseName) - offsetof(UA_ReferenceDescription, nodeId) - sizeof(UA_ExpandedNodeId),
10716  .isArray = false
10717  },
10718  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10719 #ifdef UA_ENABLE_TYPENAMES
10720  .memberName = "displayName",
10721 #endif
10722  .namespaceZero = true,
10723  .padding = offsetof(UA_ReferenceDescription, displayName) - offsetof(UA_ReferenceDescription, browseName) - sizeof(UA_QualifiedName),
10724  .isArray = false
10725  },
10726  { .memberTypeIndex = UA_TYPES_NODECLASS,
10727 #ifdef UA_ENABLE_TYPENAMES
10728  .memberName = "nodeClass",
10729 #endif
10730  .namespaceZero = true,
10731  .padding = offsetof(UA_ReferenceDescription, nodeClass) - offsetof(UA_ReferenceDescription, displayName) - sizeof(UA_LocalizedText),
10732  .isArray = false
10733  },
10734  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
10735 #ifdef UA_ENABLE_TYPENAMES
10736  .memberName = "typeDefinition",
10737 #endif
10738  .namespaceZero = true,
10739  .padding = offsetof(UA_ReferenceDescription, typeDefinition) - offsetof(UA_ReferenceDescription, nodeClass) - sizeof(UA_NodeClass),
10740  .isArray = false
10741  },};
10742 
10743 /* SetPublishingModeResponse */
10744 static UA_DataTypeMember SetPublishingModeResponse_members[3] = {
10746 #ifdef UA_ENABLE_TYPENAMES
10747  .memberName = "responseHeader",
10748 #endif
10749  .namespaceZero = true,
10750  .padding = 0,
10751  .isArray = false
10752  },
10753  { .memberTypeIndex = UA_TYPES_STATUSCODE,
10754 #ifdef UA_ENABLE_TYPENAMES
10755  .memberName = "results",
10756 #endif
10757  .namespaceZero = true,
10758  .padding = offsetof(UA_SetPublishingModeResponse, resultsSize) - offsetof(UA_SetPublishingModeResponse, responseHeader) - sizeof(UA_ResponseHeader),
10759  .isArray = true
10760  },
10761  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10762 #ifdef UA_ENABLE_TYPENAMES
10763  .memberName = "diagnosticInfos",
10764 #endif
10765  .namespaceZero = true,
10766  .padding = offsetof(UA_SetPublishingModeResponse, diagnosticInfosSize) - offsetof(UA_SetPublishingModeResponse, results) - sizeof(void*),
10767  .isArray = true
10768  },};
10769 
10770 /* ContentFilterResult */
10771 static UA_DataTypeMember ContentFilterResult_members[2] = {
10773 #ifdef UA_ENABLE_TYPENAMES
10774  .memberName = "elementResults",
10775 #endif
10776  .namespaceZero = true,
10777  .padding = 0,
10778  .isArray = true
10779  },
10780  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10781 #ifdef UA_ENABLE_TYPENAMES
10782  .memberName = "elementDiagnosticInfos",
10783 #endif
10784  .namespaceZero = true,
10785  .padding = offsetof(UA_ContentFilterResult, elementDiagnosticInfosSize) - offsetof(UA_ContentFilterResult, elementResults) - sizeof(void*),
10786  .isArray = true
10787  },};
10788 
10789 /* AddReferencesItem */
10790 static UA_DataTypeMember AddReferencesItem_members[6] = {
10792 #ifdef UA_ENABLE_TYPENAMES
10793  .memberName = "sourceNodeId",
10794 #endif
10795  .namespaceZero = true,
10796  .padding = 0,
10797  .isArray = false
10798  },
10799  { .memberTypeIndex = UA_TYPES_NODEID,
10800 #ifdef UA_ENABLE_TYPENAMES
10801  .memberName = "referenceTypeId",
10802 #endif
10803  .namespaceZero = true,
10804  .padding = offsetof(UA_AddReferencesItem, referenceTypeId) - offsetof(UA_AddReferencesItem, sourceNodeId) - sizeof(UA_NodeId),
10805  .isArray = false
10806  },
10807  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10808 #ifdef UA_ENABLE_TYPENAMES
10809  .memberName = "isForward",
10810 #endif
10811  .namespaceZero = true,
10812  .padding = offsetof(UA_AddReferencesItem, isForward) - offsetof(UA_AddReferencesItem, referenceTypeId) - sizeof(UA_NodeId),
10813  .isArray = false
10814  },
10815  { .memberTypeIndex = UA_TYPES_STRING,
10816 #ifdef UA_ENABLE_TYPENAMES
10817  .memberName = "targetServerUri",
10818 #endif
10819  .namespaceZero = true,
10820  .padding = offsetof(UA_AddReferencesItem, targetServerUri) - offsetof(UA_AddReferencesItem, isForward) - sizeof(UA_Boolean),
10821  .isArray = false
10822  },
10823  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
10824 #ifdef UA_ENABLE_TYPENAMES
10825  .memberName = "targetNodeId",
10826 #endif
10827  .namespaceZero = true,
10828  .padding = offsetof(UA_AddReferencesItem, targetNodeId) - offsetof(UA_AddReferencesItem, targetServerUri) - sizeof(UA_String),
10829  .isArray = false
10830  },
10831  { .memberTypeIndex = UA_TYPES_NODECLASS,
10832 #ifdef UA_ENABLE_TYPENAMES
10833  .memberName = "targetNodeClass",
10834 #endif
10835  .namespaceZero = true,
10836  .padding = offsetof(UA_AddReferencesItem, targetNodeClass) - offsetof(UA_AddReferencesItem, targetNodeId) - sizeof(UA_ExpandedNodeId),
10837  .isArray = false
10838  },};
10839 
10840 /* CreateSubscriptionResponse */
10841 static UA_DataTypeMember CreateSubscriptionResponse_members[5] = {
10843 #ifdef UA_ENABLE_TYPENAMES
10844  .memberName = "responseHeader",
10845 #endif
10846  .namespaceZero = true,
10847  .padding = 0,
10848  .isArray = false
10849  },
10850  { .memberTypeIndex = UA_TYPES_UINT32,
10851 #ifdef UA_ENABLE_TYPENAMES
10852  .memberName = "subscriptionId",
10853 #endif
10854  .namespaceZero = true,
10855  .padding = offsetof(UA_CreateSubscriptionResponse, subscriptionId) - offsetof(UA_CreateSubscriptionResponse, responseHeader) - sizeof(UA_ResponseHeader),
10856  .isArray = false
10857  },
10858  { .memberTypeIndex = UA_TYPES_DOUBLE,
10859 #ifdef UA_ENABLE_TYPENAMES
10860  .memberName = "revisedPublishingInterval",
10861 #endif
10862  .namespaceZero = true,
10863  .padding = offsetof(UA_CreateSubscriptionResponse, revisedPublishingInterval) - offsetof(UA_CreateSubscriptionResponse, subscriptionId) - sizeof(UA_UInt32),
10864  .isArray = false
10865  },
10866  { .memberTypeIndex = UA_TYPES_UINT32,
10867 #ifdef UA_ENABLE_TYPENAMES
10868  .memberName = "revisedLifetimeCount",
10869 #endif
10870  .namespaceZero = true,
10871  .padding = offsetof(UA_CreateSubscriptionResponse, revisedLifetimeCount) - offsetof(UA_CreateSubscriptionResponse, revisedPublishingInterval) - sizeof(UA_Double),
10872  .isArray = false
10873  },
10874  { .memberTypeIndex = UA_TYPES_UINT32,
10875 #ifdef UA_ENABLE_TYPENAMES
10876  .memberName = "revisedMaxKeepAliveCount",
10877 #endif
10878  .namespaceZero = true,
10879  .padding = offsetof(UA_CreateSubscriptionResponse, revisedMaxKeepAliveCount) - offsetof(UA_CreateSubscriptionResponse, revisedLifetimeCount) - sizeof(UA_UInt32),
10880  .isArray = false
10881  },};
10882 
10883 /* DeleteSubscriptionsResponse */
10884 static UA_DataTypeMember DeleteSubscriptionsResponse_members[3] = {
10886 #ifdef UA_ENABLE_TYPENAMES
10887  .memberName = "responseHeader",
10888 #endif
10889  .namespaceZero = true,
10890  .padding = 0,
10891  .isArray = false
10892  },
10893  { .memberTypeIndex = UA_TYPES_STATUSCODE,
10894 #ifdef UA_ENABLE_TYPENAMES
10895  .memberName = "results",
10896 #endif
10897  .namespaceZero = true,
10898  .padding = offsetof(UA_DeleteSubscriptionsResponse, resultsSize) - offsetof(UA_DeleteSubscriptionsResponse, responseHeader) - sizeof(UA_ResponseHeader),
10899  .isArray = true
10900  },
10901  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10902 #ifdef UA_ENABLE_TYPENAMES
10903  .memberName = "diagnosticInfos",
10904 #endif
10905  .namespaceZero = true,
10906  .padding = offsetof(UA_DeleteSubscriptionsResponse, diagnosticInfosSize) - offsetof(UA_DeleteSubscriptionsResponse, results) - sizeof(void*),
10907  .isArray = true
10908  },};
10909 
10910 /* RelativePath */
10911 static UA_DataTypeMember RelativePath_members[1] = {
10913 #ifdef UA_ENABLE_TYPENAMES
10914  .memberName = "elements",
10915 #endif
10916  .namespaceZero = true,
10917  .padding = 0,
10918  .isArray = true
10919  },};
10920 
10921 /* DeleteReferencesResponse */
10922 static UA_DataTypeMember DeleteReferencesResponse_members[3] = {
10924 #ifdef UA_ENABLE_TYPENAMES
10925  .memberName = "responseHeader",
10926 #endif
10927  .namespaceZero = true,
10928  .padding = 0,
10929  .isArray = false
10930  },
10931  { .memberTypeIndex = UA_TYPES_STATUSCODE,
10932 #ifdef UA_ENABLE_TYPENAMES
10933  .memberName = "results",
10934 #endif
10935  .namespaceZero = true,
10936  .padding = offsetof(UA_DeleteReferencesResponse, resultsSize) - offsetof(UA_DeleteReferencesResponse, responseHeader) - sizeof(UA_ResponseHeader),
10937  .isArray = true
10938  },
10939  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10940 #ifdef UA_ENABLE_TYPENAMES
10941  .memberName = "diagnosticInfos",
10942 #endif
10943  .namespaceZero = true,
10944  .padding = offsetof(UA_DeleteReferencesResponse, diagnosticInfosSize) - offsetof(UA_DeleteReferencesResponse, results) - sizeof(void*),
10945  .isArray = true
10946  },};
10947 
10948 /* CreateMonitoredItemsResponse */
10949 static UA_DataTypeMember CreateMonitoredItemsResponse_members[3] = {
10951 #ifdef UA_ENABLE_TYPENAMES
10952  .memberName = "responseHeader",
10953 #endif
10954  .namespaceZero = true,
10955  .padding = 0,
10956  .isArray = false
10957  },
10958  { .memberTypeIndex = UA_TYPES_MONITOREDITEMCREATERESULT,
10959 #ifdef UA_ENABLE_TYPENAMES
10960  .memberName = "results",
10961 #endif
10962  .namespaceZero = true,
10963  .padding = offsetof(UA_CreateMonitoredItemsResponse, resultsSize) - offsetof(UA_CreateMonitoredItemsResponse, responseHeader) - sizeof(UA_ResponseHeader),
10964  .isArray = true
10965  },
10966  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10967 #ifdef UA_ENABLE_TYPENAMES
10968  .memberName = "diagnosticInfos",
10969 #endif
10970  .namespaceZero = true,
10971  .padding = offsetof(UA_CreateMonitoredItemsResponse, diagnosticInfosSize) - offsetof(UA_CreateMonitoredItemsResponse, results) - sizeof(void*),
10972  .isArray = true
10973  },};
10974 
10975 /* CallResponse */
10976 static UA_DataTypeMember CallResponse_members[3] = {
10978 #ifdef UA_ENABLE_TYPENAMES
10979  .memberName = "responseHeader",
10980 #endif
10981  .namespaceZero = true,
10982  .padding = 0,
10983  .isArray = false
10984  },
10985  { .memberTypeIndex = UA_TYPES_CALLMETHODRESULT,
10986 #ifdef UA_ENABLE_TYPENAMES
10987  .memberName = "results",
10988 #endif
10989  .namespaceZero = true,
10990  .padding = offsetof(UA_CallResponse, resultsSize) - offsetof(UA_CallResponse, responseHeader) - sizeof(UA_ResponseHeader),
10991  .isArray = true
10992  },
10993  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10994 #ifdef UA_ENABLE_TYPENAMES
10995  .memberName = "diagnosticInfos",
10996 #endif
10997  .namespaceZero = true,
10998  .padding = offsetof(UA_CallResponse, diagnosticInfosSize) - offsetof(UA_CallResponse, results) - sizeof(void*),
10999  .isArray = true
11000  },};
11001 
11002 /* DeleteNodesResponse */
11003 static UA_DataTypeMember DeleteNodesResponse_members[3] = {
11005 #ifdef UA_ENABLE_TYPENAMES
11006  .memberName = "responseHeader",
11007 #endif
11008  .namespaceZero = true,
11009  .padding = 0,
11010  .isArray = false
11011  },
11012  { .memberTypeIndex = UA_TYPES_STATUSCODE,
11013 #ifdef UA_ENABLE_TYPENAMES
11014  .memberName = "results",
11015 #endif
11016  .namespaceZero = true,
11017  .padding = offsetof(UA_DeleteNodesResponse, resultsSize) - offsetof(UA_DeleteNodesResponse, responseHeader) - sizeof(UA_ResponseHeader),
11018  .isArray = true
11019  },
11020  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11021 #ifdef UA_ENABLE_TYPENAMES
11022  .memberName = "diagnosticInfos",
11023 #endif
11024  .namespaceZero = true,
11025  .padding = offsetof(UA_DeleteNodesResponse, diagnosticInfosSize) - offsetof(UA_DeleteNodesResponse, results) - sizeof(void*),
11026  .isArray = true
11027  },};
11028 
11029 /* RepublishResponse */
11030 static UA_DataTypeMember RepublishResponse_members[2] = {
11032 #ifdef UA_ENABLE_TYPENAMES
11033  .memberName = "responseHeader",
11034 #endif
11035  .namespaceZero = true,
11036  .padding = 0,
11037  .isArray = false
11038  },
11039  { .memberTypeIndex = UA_TYPES_NOTIFICATIONMESSAGE,
11040 #ifdef UA_ENABLE_TYPENAMES
11041  .memberName = "notificationMessage",
11042 #endif
11043  .namespaceZero = true,
11044  .padding = offsetof(UA_RepublishResponse, notificationMessage) - offsetof(UA_RepublishResponse, responseHeader) - sizeof(UA_ResponseHeader),
11045  .isArray = false
11046  },};
11047 
11048 /* MonitoredItemCreateRequest */
11049 static UA_DataTypeMember MonitoredItemCreateRequest_members[3] = {
11051 #ifdef UA_ENABLE_TYPENAMES
11052  .memberName = "itemToMonitor",
11053 #endif
11054  .namespaceZero = true,
11055  .padding = 0,
11056  .isArray = false
11057  },
11058  { .memberTypeIndex = UA_TYPES_MONITORINGMODE,
11059 #ifdef UA_ENABLE_TYPENAMES
11060  .memberName = "monitoringMode",
11061 #endif
11062  .namespaceZero = true,
11063  .padding = offsetof(UA_MonitoredItemCreateRequest, monitoringMode) - offsetof(UA_MonitoredItemCreateRequest, itemToMonitor) - sizeof(UA_ReadValueId),
11064  .isArray = false
11065  },
11066  { .memberTypeIndex = UA_TYPES_MONITORINGPARAMETERS,
11067 #ifdef UA_ENABLE_TYPENAMES
11068  .memberName = "requestedParameters",
11069 #endif
11070  .namespaceZero = true,
11071  .padding = offsetof(UA_MonitoredItemCreateRequest, requestedParameters) - offsetof(UA_MonitoredItemCreateRequest, monitoringMode) - sizeof(UA_MonitoringMode),
11072  .isArray = false
11073  },};
11074 
11075 /* DeleteReferencesRequest */
11076 static UA_DataTypeMember DeleteReferencesRequest_members[2] = {
11078 #ifdef UA_ENABLE_TYPENAMES
11079  .memberName = "requestHeader",
11080 #endif
11081  .namespaceZero = true,
11082  .padding = 0,
11083  .isArray = false
11084  },
11085  { .memberTypeIndex = UA_TYPES_DELETEREFERENCESITEM,
11086 #ifdef UA_ENABLE_TYPENAMES
11087  .memberName = "referencesToDelete",
11088 #endif
11089  .namespaceZero = true,
11090  .padding = offsetof(UA_DeleteReferencesRequest, referencesToDeleteSize) - offsetof(UA_DeleteReferencesRequest, requestHeader) - sizeof(UA_RequestHeader),
11091  .isArray = true
11092  },};
11093 
11094 /* ModifyMonitoredItemsResponse */
11095 static UA_DataTypeMember ModifyMonitoredItemsResponse_members[3] = {
11097 #ifdef UA_ENABLE_TYPENAMES
11098  .memberName = "responseHeader",
11099 #endif
11100  .namespaceZero = true,
11101  .padding = 0,
11102  .isArray = false
11103  },
11104  { .memberTypeIndex = UA_TYPES_MONITOREDITEMMODIFYRESULT,
11105 #ifdef UA_ENABLE_TYPENAMES
11106  .memberName = "results",
11107 #endif
11108  .namespaceZero = true,
11109  .padding = offsetof(UA_ModifyMonitoredItemsResponse, resultsSize) - offsetof(UA_ModifyMonitoredItemsResponse, responseHeader) - sizeof(UA_ResponseHeader),
11110  .isArray = true
11111  },
11112  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11113 #ifdef UA_ENABLE_TYPENAMES
11114  .memberName = "diagnosticInfos",
11115 #endif
11116  .namespaceZero = true,
11117  .padding = offsetof(UA_ModifyMonitoredItemsResponse, diagnosticInfosSize) - offsetof(UA_ModifyMonitoredItemsResponse, results) - sizeof(void*),
11118  .isArray = true
11119  },};
11120 
11121 /* ReadResponse */
11122 static UA_DataTypeMember ReadResponse_members[3] = {
11124 #ifdef UA_ENABLE_TYPENAMES
11125  .memberName = "responseHeader",
11126 #endif
11127  .namespaceZero = true,
11128  .padding = 0,
11129  .isArray = false
11130  },
11131  { .memberTypeIndex = UA_TYPES_DATAVALUE,
11132 #ifdef UA_ENABLE_TYPENAMES
11133  .memberName = "results",
11134 #endif
11135  .namespaceZero = true,
11136  .padding = offsetof(UA_ReadResponse, resultsSize) - offsetof(UA_ReadResponse, responseHeader) - sizeof(UA_ResponseHeader),
11137  .isArray = true
11138  },
11139  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11140 #ifdef UA_ENABLE_TYPENAMES
11141  .memberName = "diagnosticInfos",
11142 #endif
11143  .namespaceZero = true,
11144  .padding = offsetof(UA_ReadResponse, diagnosticInfosSize) - offsetof(UA_ReadResponse, results) - sizeof(void*),
11145  .isArray = true
11146  },};
11147 
11148 /* AddReferencesRequest */
11149 static UA_DataTypeMember AddReferencesRequest_members[2] = {
11151 #ifdef UA_ENABLE_TYPENAMES
11152  .memberName = "requestHeader",
11153 #endif
11154  .namespaceZero = true,
11155  .padding = 0,
11156  .isArray = false
11157  },
11158  { .memberTypeIndex = UA_TYPES_ADDREFERENCESITEM,
11159 #ifdef UA_ENABLE_TYPENAMES
11160  .memberName = "referencesToAdd",
11161 #endif
11162  .namespaceZero = true,
11163  .padding = offsetof(UA_AddReferencesRequest, referencesToAddSize) - offsetof(UA_AddReferencesRequest, requestHeader) - sizeof(UA_RequestHeader),
11164  .isArray = true
11165  },};
11166 
11167 /* ReadRequest */
11168 static UA_DataTypeMember ReadRequest_members[4] = {
11170 #ifdef UA_ENABLE_TYPENAMES
11171  .memberName = "requestHeader",
11172 #endif
11173  .namespaceZero = true,
11174  .padding = 0,
11175  .isArray = false
11176  },
11177  { .memberTypeIndex = UA_TYPES_DOUBLE,
11178 #ifdef UA_ENABLE_TYPENAMES
11179  .memberName = "maxAge",
11180 #endif
11181  .namespaceZero = true,
11182  .padding = offsetof(UA_ReadRequest, maxAge) - offsetof(UA_ReadRequest, requestHeader) - sizeof(UA_RequestHeader),
11183  .isArray = false
11184  },
11185  { .memberTypeIndex = UA_TYPES_TIMESTAMPSTORETURN,
11186 #ifdef UA_ENABLE_TYPENAMES
11187  .memberName = "timestampsToReturn",
11188 #endif
11189  .namespaceZero = true,
11190  .padding = offsetof(UA_ReadRequest, timestampsToReturn) - offsetof(UA_ReadRequest, maxAge) - sizeof(UA_Double),
11191  .isArray = false
11192  },
11193  { .memberTypeIndex = UA_TYPES_READVALUEID,
11194 #ifdef UA_ENABLE_TYPENAMES
11195  .memberName = "nodesToRead",
11196 #endif
11197  .namespaceZero = true,
11198  .padding = offsetof(UA_ReadRequest, nodesToReadSize) - offsetof(UA_ReadRequest, timestampsToReturn) - sizeof(UA_TimestampsToReturn),
11199  .isArray = true
11200  },};
11201 
11202 /* AddNodesItem */
11203 static UA_DataTypeMember AddNodesItem_members[7] = {
11205 #ifdef UA_ENABLE_TYPENAMES
11206  .memberName = "parentNodeId",
11207 #endif
11208  .namespaceZero = true,
11209  .padding = 0,
11210  .isArray = false
11211  },
11212  { .memberTypeIndex = UA_TYPES_NODEID,
11213 #ifdef UA_ENABLE_TYPENAMES
11214  .memberName = "referenceTypeId",
11215 #endif
11216  .namespaceZero = true,
11217  .padding = offsetof(UA_AddNodesItem, referenceTypeId) - offsetof(UA_AddNodesItem, parentNodeId) - sizeof(UA_ExpandedNodeId),
11218  .isArray = false
11219  },
11220  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
11221 #ifdef UA_ENABLE_TYPENAMES
11222  .memberName = "requestedNewNodeId",
11223 #endif
11224  .namespaceZero = true,
11225  .padding = offsetof(UA_AddNodesItem, requestedNewNodeId) - offsetof(UA_AddNodesItem, referenceTypeId) - sizeof(UA_NodeId),
11226  .isArray = false
11227  },
11228  { .memberTypeIndex = UA_TYPES_QUALIFIEDNAME,
11229 #ifdef UA_ENABLE_TYPENAMES
11230  .memberName = "browseName",
11231 #endif
11232  .namespaceZero = true,
11233  .padding = offsetof(UA_AddNodesItem, browseName) - offsetof(UA_AddNodesItem, requestedNewNodeId) - sizeof(UA_ExpandedNodeId),
11234  .isArray = false
11235  },
11236  { .memberTypeIndex = UA_TYPES_NODECLASS,
11237 #ifdef UA_ENABLE_TYPENAMES
11238  .memberName = "nodeClass",
11239 #endif
11240  .namespaceZero = true,
11241  .padding = offsetof(UA_AddNodesItem, nodeClass) - offsetof(UA_AddNodesItem, browseName) - sizeof(UA_QualifiedName),
11242  .isArray = false
11243  },
11244  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
11245 #ifdef UA_ENABLE_TYPENAMES
11246  .memberName = "nodeAttributes",
11247 #endif
11248  .namespaceZero = true,
11249  .padding = offsetof(UA_AddNodesItem, nodeAttributes) - offsetof(UA_AddNodesItem, nodeClass) - sizeof(UA_NodeClass),
11250  .isArray = false
11251  },
11252  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
11253 #ifdef UA_ENABLE_TYPENAMES
11254  .memberName = "typeDefinition",
11255 #endif
11256  .namespaceZero = true,
11257  .padding = offsetof(UA_AddNodesItem, typeDefinition) - offsetof(UA_AddNodesItem, nodeAttributes) - sizeof(UA_ExtensionObject),
11258  .isArray = false
11259  },};
11260 
11261 /* ServerStatusDataType */
11262 static UA_DataTypeMember ServerStatusDataType_members[6] = {
11264 #ifdef UA_ENABLE_TYPENAMES
11265  .memberName = "startTime",
11266 #endif
11267  .namespaceZero = true,
11268  .padding = 0,
11269  .isArray = false
11270  },
11271  { .memberTypeIndex = UA_TYPES_DATETIME,
11272 #ifdef UA_ENABLE_TYPENAMES
11273  .memberName = "currentTime",
11274 #endif
11275  .namespaceZero = true,
11276  .padding = offsetof(UA_ServerStatusDataType, currentTime) - offsetof(UA_ServerStatusDataType, startTime) - sizeof(UA_DateTime),
11277  .isArray = false
11278  },
11279  { .memberTypeIndex = UA_TYPES_SERVERSTATE,
11280 #ifdef UA_ENABLE_TYPENAMES
11281  .memberName = "state",
11282 #endif
11283  .namespaceZero = true,
11284  .padding = offsetof(UA_ServerStatusDataType, state) - offsetof(UA_ServerStatusDataType, currentTime) - sizeof(UA_DateTime),
11285  .isArray = false
11286  },
11287  { .memberTypeIndex = UA_TYPES_BUILDINFO,
11288 #ifdef UA_ENABLE_TYPENAMES
11289  .memberName = "buildInfo",
11290 #endif
11291  .namespaceZero = true,
11292  .padding = offsetof(UA_ServerStatusDataType, buildInfo) - offsetof(UA_ServerStatusDataType, state) - sizeof(UA_ServerState),
11293  .isArray = false
11294  },
11295  { .memberTypeIndex = UA_TYPES_UINT32,
11296 #ifdef UA_ENABLE_TYPENAMES
11297  .memberName = "secondsTillShutdown",
11298 #endif
11299  .namespaceZero = true,
11300  .padding = offsetof(UA_ServerStatusDataType, secondsTillShutdown) - offsetof(UA_ServerStatusDataType, buildInfo) - sizeof(UA_BuildInfo),
11301  .isArray = false
11302  },
11303  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
11304 #ifdef UA_ENABLE_TYPENAMES
11305  .memberName = "shutdownReason",
11306 #endif
11307  .namespaceZero = true,
11308  .padding = offsetof(UA_ServerStatusDataType, shutdownReason) - offsetof(UA_ServerStatusDataType, secondsTillShutdown) - sizeof(UA_UInt32),
11309  .isArray = false
11310  },};
11311 
11312 /* AddReferencesResponse */
11313 static UA_DataTypeMember AddReferencesResponse_members[3] = {
11315 #ifdef UA_ENABLE_TYPENAMES
11316  .memberName = "responseHeader",
11317 #endif
11318  .namespaceZero = true,
11319  .padding = 0,
11320  .isArray = false
11321  },
11322  { .memberTypeIndex = UA_TYPES_STATUSCODE,
11323 #ifdef UA_ENABLE_TYPENAMES
11324  .memberName = "results",
11325 #endif
11326  .namespaceZero = true,
11327  .padding = offsetof(UA_AddReferencesResponse, resultsSize) - offsetof(UA_AddReferencesResponse, responseHeader) - sizeof(UA_ResponseHeader),
11328  .isArray = true
11329  },
11330  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11331 #ifdef UA_ENABLE_TYPENAMES
11332  .memberName = "diagnosticInfos",
11333 #endif
11334  .namespaceZero = true,
11335  .padding = offsetof(UA_AddReferencesResponse, diagnosticInfosSize) - offsetof(UA_AddReferencesResponse, results) - sizeof(void*),
11336  .isArray = true
11337  },};
11338 
11339 /* TranslateBrowsePathsToNodeIdsResponse */
11340 static UA_DataTypeMember TranslateBrowsePathsToNodeIdsResponse_members[3] = {
11342 #ifdef UA_ENABLE_TYPENAMES
11343  .memberName = "responseHeader",
11344 #endif
11345  .namespaceZero = true,
11346  .padding = 0,
11347  .isArray = false
11348  },
11349  { .memberTypeIndex = UA_TYPES_BROWSEPATHRESULT,
11350 #ifdef UA_ENABLE_TYPENAMES
11351  .memberName = "results",
11352 #endif
11353  .namespaceZero = true,
11354  .padding = offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, resultsSize) - offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, responseHeader) - sizeof(UA_ResponseHeader),
11355  .isArray = true
11356  },
11357  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11358 #ifdef UA_ENABLE_TYPENAMES
11359  .memberName = "diagnosticInfos",
11360 #endif
11361  .namespaceZero = true,
11362  .padding = offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, diagnosticInfosSize) - offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, results) - sizeof(void*),
11363  .isArray = true
11364  },};
11365 
11366 /* DataChangeFilter */
11367 static UA_DataTypeMember DataChangeFilter_members[3] = {
11369 #ifdef UA_ENABLE_TYPENAMES
11370  .memberName = "trigger",
11371 #endif
11372  .namespaceZero = true,
11373  .padding = 0,
11374  .isArray = false
11375  },
11376  { .memberTypeIndex = UA_TYPES_UINT32,
11377 #ifdef UA_ENABLE_TYPENAMES
11378  .memberName = "deadbandType",
11379 #endif
11380  .namespaceZero = true,
11381  .padding = offsetof(UA_DataChangeFilter, deadbandType) - offsetof(UA_DataChangeFilter, trigger) - sizeof(UA_DataChangeTrigger),
11382  .isArray = false
11383  },
11384  { .memberTypeIndex = UA_TYPES_DOUBLE,
11385 #ifdef UA_ENABLE_TYPENAMES
11386  .memberName = "deadbandValue",
11387 #endif
11388  .namespaceZero = true,
11389  .padding = offsetof(UA_DataChangeFilter, deadbandValue) - offsetof(UA_DataChangeFilter, deadbandType) - sizeof(UA_UInt32),
11390  .isArray = false
11391  },};
11392 
11393 /* ContentFilterElement */
11394 static UA_DataTypeMember ContentFilterElement_members[2] = {
11396 #ifdef UA_ENABLE_TYPENAMES
11397  .memberName = "filterOperator",
11398 #endif
11399  .namespaceZero = true,
11400  .padding = 0,
11401  .isArray = false
11402  },
11403  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
11404 #ifdef UA_ENABLE_TYPENAMES
11405  .memberName = "filterOperands",
11406 #endif
11407  .namespaceZero = true,
11408  .padding = offsetof(UA_ContentFilterElement, filterOperandsSize) - offsetof(UA_ContentFilterElement, filterOperator) - sizeof(UA_FilterOperator),
11409  .isArray = true
11410  },};
11411 
11412 /* CloseSessionResponse */
11413 static UA_DataTypeMember CloseSessionResponse_members[1] = {
11415 #ifdef UA_ENABLE_TYPENAMES
11416  .memberName = "responseHeader",
11417 #endif
11418  .namespaceZero = true,
11419  .padding = 0,
11420  .isArray = false
11421  },};
11422 
11423 /* ApplicationDescription */
11424 static UA_DataTypeMember ApplicationDescription_members[7] = {
11426 #ifdef UA_ENABLE_TYPENAMES
11427  .memberName = "applicationUri",
11428 #endif
11429  .namespaceZero = true,
11430  .padding = 0,
11431  .isArray = false
11432  },
11433  { .memberTypeIndex = UA_TYPES_STRING,
11434 #ifdef UA_ENABLE_TYPENAMES
11435  .memberName = "productUri",
11436 #endif
11437  .namespaceZero = true,
11438  .padding = offsetof(UA_ApplicationDescription, productUri) - offsetof(UA_ApplicationDescription, applicationUri) - sizeof(UA_String),
11439  .isArray = false
11440  },
11441  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
11442 #ifdef UA_ENABLE_TYPENAMES
11443  .memberName = "applicationName",
11444 #endif
11445  .namespaceZero = true,
11446  .padding = offsetof(UA_ApplicationDescription, applicationName) - offsetof(UA_ApplicationDescription, productUri) - sizeof(UA_String),
11447  .isArray = false
11448  },
11449  { .memberTypeIndex = UA_TYPES_APPLICATIONTYPE,
11450 #ifdef UA_ENABLE_TYPENAMES
11451  .memberName = "applicationType",
11452 #endif
11453  .namespaceZero = true,
11454  .padding = offsetof(UA_ApplicationDescription, applicationType) - offsetof(UA_ApplicationDescription, applicationName) - sizeof(UA_LocalizedText),
11455  .isArray = false
11456  },
11457  { .memberTypeIndex = UA_TYPES_STRING,
11458 #ifdef UA_ENABLE_TYPENAMES
11459  .memberName = "gatewayServerUri",
11460 #endif
11461  .namespaceZero = true,
11462  .padding = offsetof(UA_ApplicationDescription, gatewayServerUri) - offsetof(UA_ApplicationDescription, applicationType) - sizeof(UA_ApplicationType),
11463  .isArray = false
11464  },
11465  { .memberTypeIndex = UA_TYPES_STRING,
11466 #ifdef UA_ENABLE_TYPENAMES
11467  .memberName = "discoveryProfileUri",
11468 #endif
11469  .namespaceZero = true,
11470  .padding = offsetof(UA_ApplicationDescription, discoveryProfileUri) - offsetof(UA_ApplicationDescription, gatewayServerUri) - sizeof(UA_String),
11471  .isArray = false
11472  },
11473  { .memberTypeIndex = UA_TYPES_STRING,
11474 #ifdef UA_ENABLE_TYPENAMES
11475  .memberName = "discoveryUrls",
11476 #endif
11477  .namespaceZero = true,
11478  .padding = offsetof(UA_ApplicationDescription, discoveryUrlsSize) - offsetof(UA_ApplicationDescription, discoveryProfileUri) - sizeof(UA_String),
11479  .isArray = true
11480  },};
11481 
11482 /* ServiceFault */
11483 static UA_DataTypeMember ServiceFault_members[1] = {
11485 #ifdef UA_ENABLE_TYPENAMES
11486  .memberName = "responseHeader",
11487 #endif
11488  .namespaceZero = true,
11489  .padding = 0,
11490  .isArray = false
11491  },};
11492 
11493 /* FindServersResponse */
11494 static UA_DataTypeMember FindServersResponse_members[2] = {
11496 #ifdef UA_ENABLE_TYPENAMES
11497  .memberName = "responseHeader",
11498 #endif
11499  .namespaceZero = true,
11500  .padding = 0,
11501  .isArray = false
11502  },
11503  { .memberTypeIndex = UA_TYPES_APPLICATIONDESCRIPTION,
11504 #ifdef UA_ENABLE_TYPENAMES
11505  .memberName = "servers",
11506 #endif
11507  .namespaceZero = true,
11508  .padding = offsetof(UA_FindServersResponse, serversSize) - offsetof(UA_FindServersResponse, responseHeader) - sizeof(UA_ResponseHeader),
11509  .isArray = true
11510  },};
11511 
11512 /* CreateMonitoredItemsRequest */
11513 static UA_DataTypeMember CreateMonitoredItemsRequest_members[4] = {
11515 #ifdef UA_ENABLE_TYPENAMES
11516  .memberName = "requestHeader",
11517 #endif
11518  .namespaceZero = true,
11519  .padding = 0,
11520  .isArray = false
11521  },
11522  { .memberTypeIndex = UA_TYPES_UINT32,
11523 #ifdef UA_ENABLE_TYPENAMES
11524  .memberName = "subscriptionId",
11525 #endif
11526  .namespaceZero = true,
11527  .padding = offsetof(UA_CreateMonitoredItemsRequest, subscriptionId) - offsetof(UA_CreateMonitoredItemsRequest, requestHeader) - sizeof(UA_RequestHeader),
11528  .isArray = false
11529  },
11530  { .memberTypeIndex = UA_TYPES_TIMESTAMPSTORETURN,
11531 #ifdef UA_ENABLE_TYPENAMES
11532  .memberName = "timestampsToReturn",
11533 #endif
11534  .namespaceZero = true,
11535  .padding = offsetof(UA_CreateMonitoredItemsRequest, timestampsToReturn) - offsetof(UA_CreateMonitoredItemsRequest, subscriptionId) - sizeof(UA_UInt32),
11536  .isArray = false
11537  },
11538  { .memberTypeIndex = UA_TYPES_MONITOREDITEMCREATEREQUEST,
11539 #ifdef UA_ENABLE_TYPENAMES
11540  .memberName = "itemsToCreate",
11541 #endif
11542  .namespaceZero = true,
11543  .padding = offsetof(UA_CreateMonitoredItemsRequest, itemsToCreateSize) - offsetof(UA_CreateMonitoredItemsRequest, timestampsToReturn) - sizeof(UA_TimestampsToReturn),
11544  .isArray = true
11545  },};
11546 
11547 /* ContentFilter */
11548 static UA_DataTypeMember ContentFilter_members[1] = {
11550 #ifdef UA_ENABLE_TYPENAMES
11551  .memberName = "elements",
11552 #endif
11553  .namespaceZero = true,
11554  .padding = 0,
11555  .isArray = true
11556  },};
11557 
11558 /* QueryFirstResponse */
11559 static UA_DataTypeMember QueryFirstResponse_members[6] = {
11561 #ifdef UA_ENABLE_TYPENAMES
11562  .memberName = "responseHeader",
11563 #endif
11564  .namespaceZero = true,
11565  .padding = 0,
11566  .isArray = false
11567  },
11568  { .memberTypeIndex = UA_TYPES_QUERYDATASET,
11569 #ifdef UA_ENABLE_TYPENAMES
11570  .memberName = "queryDataSets",
11571 #endif
11572  .namespaceZero = true,
11573  .padding = offsetof(UA_QueryFirstResponse, queryDataSetsSize) - offsetof(UA_QueryFirstResponse, responseHeader) - sizeof(UA_ResponseHeader),
11574  .isArray = true
11575  },
11576  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11577 #ifdef UA_ENABLE_TYPENAMES
11578  .memberName = "continuationPoint",
11579 #endif
11580  .namespaceZero = true,
11581  .padding = offsetof(UA_QueryFirstResponse, continuationPoint) - offsetof(UA_QueryFirstResponse, queryDataSets) - sizeof(void*),
11582  .isArray = false
11583  },
11584  { .memberTypeIndex = UA_TYPES_PARSINGRESULT,
11585 #ifdef UA_ENABLE_TYPENAMES
11586  .memberName = "parsingResults",
11587 #endif
11588  .namespaceZero = true,
11589  .padding = offsetof(UA_QueryFirstResponse, parsingResultsSize) - offsetof(UA_QueryFirstResponse, continuationPoint) - sizeof(UA_ByteString),
11590  .isArray = true
11591  },
11592  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11593 #ifdef UA_ENABLE_TYPENAMES
11594  .memberName = "diagnosticInfos",
11595 #endif
11596  .namespaceZero = true,
11597  .padding = offsetof(UA_QueryFirstResponse, diagnosticInfosSize) - offsetof(UA_QueryFirstResponse, parsingResults) - sizeof(void*),
11598  .isArray = true
11599  },
11600  { .memberTypeIndex = UA_TYPES_CONTENTFILTERRESULT,
11601 #ifdef UA_ENABLE_TYPENAMES
11602  .memberName = "filterResult",
11603 #endif
11604  .namespaceZero = true,
11605  .padding = offsetof(UA_QueryFirstResponse, filterResult) - offsetof(UA_QueryFirstResponse, diagnosticInfos) - sizeof(void*),
11606  .isArray = false
11607  },};
11608 
11609 /* AddNodesRequest */
11610 static UA_DataTypeMember AddNodesRequest_members[2] = {
11612 #ifdef UA_ENABLE_TYPENAMES
11613  .memberName = "requestHeader",
11614 #endif
11615  .namespaceZero = true,
11616  .padding = 0,
11617  .isArray = false
11618  },
11619  { .memberTypeIndex = UA_TYPES_ADDNODESITEM,
11620 #ifdef UA_ENABLE_TYPENAMES
11621  .memberName = "nodesToAdd",
11622 #endif
11623  .namespaceZero = true,
11624  .padding = offsetof(UA_AddNodesRequest, nodesToAddSize) - offsetof(UA_AddNodesRequest, requestHeader) - sizeof(UA_RequestHeader),
11625  .isArray = true
11626  },};
11627 
11628 /* BrowseRequest */
11629 static UA_DataTypeMember BrowseRequest_members[4] = {
11631 #ifdef UA_ENABLE_TYPENAMES
11632  .memberName = "requestHeader",
11633 #endif
11634  .namespaceZero = true,
11635  .padding = 0,
11636  .isArray = false
11637  },
11638  { .memberTypeIndex = UA_TYPES_VIEWDESCRIPTION,
11639 #ifdef UA_ENABLE_TYPENAMES
11640  .memberName = "view",
11641 #endif
11642  .namespaceZero = true,
11643  .padding = offsetof(UA_BrowseRequest, view) - offsetof(UA_BrowseRequest, requestHeader) - sizeof(UA_RequestHeader),
11644  .isArray = false
11645  },
11646  { .memberTypeIndex = UA_TYPES_UINT32,
11647 #ifdef UA_ENABLE_TYPENAMES
11648  .memberName = "requestedMaxReferencesPerNode",
11649 #endif
11650  .namespaceZero = true,
11651  .padding = offsetof(UA_BrowseRequest, requestedMaxReferencesPerNode) - offsetof(UA_BrowseRequest, view) - sizeof(UA_ViewDescription),
11652  .isArray = false
11653  },
11654  { .memberTypeIndex = UA_TYPES_BROWSEDESCRIPTION,
11655 #ifdef UA_ENABLE_TYPENAMES
11656  .memberName = "nodesToBrowse",
11657 #endif
11658  .namespaceZero = true,
11659  .padding = offsetof(UA_BrowseRequest, nodesToBrowseSize) - offsetof(UA_BrowseRequest, requestedMaxReferencesPerNode) - sizeof(UA_UInt32),
11660  .isArray = true
11661  },};
11662 
11663 /* BrowsePath */
11664 static UA_DataTypeMember BrowsePath_members[2] = {
11666 #ifdef UA_ENABLE_TYPENAMES
11667  .memberName = "startingNode",
11668 #endif
11669  .namespaceZero = true,
11670  .padding = 0,
11671  .isArray = false
11672  },
11673  { .memberTypeIndex = UA_TYPES_RELATIVEPATH,
11674 #ifdef UA_ENABLE_TYPENAMES
11675  .memberName = "relativePath",
11676 #endif
11677  .namespaceZero = true,
11678  .padding = offsetof(UA_BrowsePath, relativePath) - offsetof(UA_BrowsePath, startingNode) - sizeof(UA_NodeId),
11679  .isArray = false
11680  },};
11681 
11682 /* BrowseResult */
11683 static UA_DataTypeMember BrowseResult_members[3] = {
11685 #ifdef UA_ENABLE_TYPENAMES
11686  .memberName = "statusCode",
11687 #endif
11688  .namespaceZero = true,
11689  .padding = 0,
11690  .isArray = false
11691  },
11692  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11693 #ifdef UA_ENABLE_TYPENAMES
11694  .memberName = "continuationPoint",
11695 #endif
11696  .namespaceZero = true,
11697  .padding = offsetof(UA_BrowseResult, continuationPoint) - offsetof(UA_BrowseResult, statusCode) - sizeof(UA_StatusCode),
11698  .isArray = false
11699  },
11700  { .memberTypeIndex = UA_TYPES_REFERENCEDESCRIPTION,
11701 #ifdef UA_ENABLE_TYPENAMES
11702  .memberName = "references",
11703 #endif
11704  .namespaceZero = true,
11705  .padding = offsetof(UA_BrowseResult, referencesSize) - offsetof(UA_BrowseResult, continuationPoint) - sizeof(UA_ByteString),
11706  .isArray = true
11707  },};
11708 
11709 /* CreateSessionRequest */
11710 static UA_DataTypeMember CreateSessionRequest_members[9] = {
11712 #ifdef UA_ENABLE_TYPENAMES
11713  .memberName = "requestHeader",
11714 #endif
11715  .namespaceZero = true,
11716  .padding = 0,
11717  .isArray = false
11718  },
11719  { .memberTypeIndex = UA_TYPES_APPLICATIONDESCRIPTION,
11720 #ifdef UA_ENABLE_TYPENAMES
11721  .memberName = "clientDescription",
11722 #endif
11723  .namespaceZero = true,
11724  .padding = offsetof(UA_CreateSessionRequest, clientDescription) - offsetof(UA_CreateSessionRequest, requestHeader) - sizeof(UA_RequestHeader),
11725  .isArray = false
11726  },
11727  { .memberTypeIndex = UA_TYPES_STRING,
11728 #ifdef UA_ENABLE_TYPENAMES
11729  .memberName = "serverUri",
11730 #endif
11731  .namespaceZero = true,
11732  .padding = offsetof(UA_CreateSessionRequest, serverUri) - offsetof(UA_CreateSessionRequest, clientDescription) - sizeof(UA_ApplicationDescription),
11733  .isArray = false
11734  },
11735  { .memberTypeIndex = UA_TYPES_STRING,
11736 #ifdef UA_ENABLE_TYPENAMES
11737  .memberName = "endpointUrl",
11738 #endif
11739  .namespaceZero = true,
11740  .padding = offsetof(UA_CreateSessionRequest, endpointUrl) - offsetof(UA_CreateSessionRequest, serverUri) - sizeof(UA_String),
11741  .isArray = false
11742  },
11743  { .memberTypeIndex = UA_TYPES_STRING,
11744 #ifdef UA_ENABLE_TYPENAMES
11745  .memberName = "sessionName",
11746 #endif
11747  .namespaceZero = true,
11748  .padding = offsetof(UA_CreateSessionRequest, sessionName) - offsetof(UA_CreateSessionRequest, endpointUrl) - sizeof(UA_String),
11749  .isArray = false
11750  },
11751  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11752 #ifdef UA_ENABLE_TYPENAMES
11753  .memberName = "clientNonce",
11754 #endif
11755  .namespaceZero = true,
11756  .padding = offsetof(UA_CreateSessionRequest, clientNonce) - offsetof(UA_CreateSessionRequest, sessionName) - sizeof(UA_String),
11757  .isArray = false
11758  },
11759  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11760 #ifdef UA_ENABLE_TYPENAMES
11761  .memberName = "clientCertificate",
11762 #endif
11763  .namespaceZero = true,
11764  .padding = offsetof(UA_CreateSessionRequest, clientCertificate) - offsetof(UA_CreateSessionRequest, clientNonce) - sizeof(UA_ByteString),
11765  .isArray = false
11766  },
11767  { .memberTypeIndex = UA_TYPES_DOUBLE,
11768 #ifdef UA_ENABLE_TYPENAMES
11769  .memberName = "requestedSessionTimeout",
11770 #endif
11771  .namespaceZero = true,
11772  .padding = offsetof(UA_CreateSessionRequest, requestedSessionTimeout) - offsetof(UA_CreateSessionRequest, clientCertificate) - sizeof(UA_ByteString),
11773  .isArray = false
11774  },
11775  { .memberTypeIndex = UA_TYPES_UINT32,
11776 #ifdef UA_ENABLE_TYPENAMES
11777  .memberName = "maxResponseMessageSize",
11778 #endif
11779  .namespaceZero = true,
11780  .padding = offsetof(UA_CreateSessionRequest, maxResponseMessageSize) - offsetof(UA_CreateSessionRequest, requestedSessionTimeout) - sizeof(UA_Double),
11781  .isArray = false
11782  },};
11783 
11784 /* QueryDataDescription */
11785 static UA_DataTypeMember QueryDataDescription_members[3] = {
11787 #ifdef UA_ENABLE_TYPENAMES
11788  .memberName = "relativePath",
11789 #endif
11790  .namespaceZero = true,
11791  .padding = 0,
11792  .isArray = false
11793  },
11794  { .memberTypeIndex = UA_TYPES_UINT32,
11795 #ifdef UA_ENABLE_TYPENAMES
11796  .memberName = "attributeId",
11797 #endif
11798  .namespaceZero = true,
11799  .padding = offsetof(UA_QueryDataDescription, attributeId) - offsetof(UA_QueryDataDescription, relativePath) - sizeof(UA_RelativePath),
11800  .isArray = false
11801  },
11802  { .memberTypeIndex = UA_TYPES_STRING,
11803 #ifdef UA_ENABLE_TYPENAMES
11804  .memberName = "indexRange",
11805 #endif
11806  .namespaceZero = true,
11807  .padding = offsetof(UA_QueryDataDescription, indexRange) - offsetof(UA_QueryDataDescription, attributeId) - sizeof(UA_UInt32),
11808  .isArray = false
11809  },};
11810 
11811 /* EndpointDescription */
11812 static UA_DataTypeMember EndpointDescription_members[8] = {
11814 #ifdef UA_ENABLE_TYPENAMES
11815  .memberName = "endpointUrl",
11816 #endif
11817  .namespaceZero = true,
11818  .padding = 0,
11819  .isArray = false
11820  },
11821  { .memberTypeIndex = UA_TYPES_APPLICATIONDESCRIPTION,
11822 #ifdef UA_ENABLE_TYPENAMES
11823  .memberName = "server",
11824 #endif
11825  .namespaceZero = true,
11826  .padding = offsetof(UA_EndpointDescription, server) - offsetof(UA_EndpointDescription, endpointUrl) - sizeof(UA_String),
11827  .isArray = false
11828  },
11829  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11830 #ifdef UA_ENABLE_TYPENAMES
11831  .memberName = "serverCertificate",
11832 #endif
11833  .namespaceZero = true,
11834  .padding = offsetof(UA_EndpointDescription, serverCertificate) - offsetof(UA_EndpointDescription, server) - sizeof(UA_ApplicationDescription),
11835  .isArray = false
11836  },
11837  { .memberTypeIndex = UA_TYPES_MESSAGESECURITYMODE,
11838 #ifdef UA_ENABLE_TYPENAMES
11839  .memberName = "securityMode",
11840 #endif
11841  .namespaceZero = true,
11842  .padding = offsetof(UA_EndpointDescription, securityMode) - offsetof(UA_EndpointDescription, serverCertificate) - sizeof(UA_ByteString),
11843  .isArray = false
11844  },
11845  { .memberTypeIndex = UA_TYPES_STRING,
11846 #ifdef UA_ENABLE_TYPENAMES
11847  .memberName = "securityPolicyUri",
11848 #endif
11849  .namespaceZero = true,
11850  .padding = offsetof(UA_EndpointDescription, securityPolicyUri) - offsetof(UA_EndpointDescription, securityMode) - sizeof(UA_MessageSecurityMode),
11851  .isArray = false
11852  },
11853  { .memberTypeIndex = UA_TYPES_USERTOKENPOLICY,
11854 #ifdef UA_ENABLE_TYPENAMES
11855  .memberName = "userIdentityTokens",
11856 #endif
11857  .namespaceZero = true,
11858  .padding = offsetof(UA_EndpointDescription, userIdentityTokensSize) - offsetof(UA_EndpointDescription, securityPolicyUri) - sizeof(UA_String),
11859  .isArray = true
11860  },
11861  { .memberTypeIndex = UA_TYPES_STRING,
11862 #ifdef UA_ENABLE_TYPENAMES
11863  .memberName = "transportProfileUri",
11864 #endif
11865  .namespaceZero = true,
11866  .padding = offsetof(UA_EndpointDescription, transportProfileUri) - offsetof(UA_EndpointDescription, userIdentityTokens) - sizeof(void*),
11867  .isArray = false
11868  },
11869  { .memberTypeIndex = UA_TYPES_BYTE,
11870 #ifdef UA_ENABLE_TYPENAMES
11871  .memberName = "securityLevel",
11872 #endif
11873  .namespaceZero = true,
11874  .padding = offsetof(UA_EndpointDescription, securityLevel) - offsetof(UA_EndpointDescription, transportProfileUri) - sizeof(UA_String),
11875  .isArray = false
11876  },};
11877 
11878 /* GetEndpointsResponse */
11879 static UA_DataTypeMember GetEndpointsResponse_members[2] = {
11881 #ifdef UA_ENABLE_TYPENAMES
11882  .memberName = "responseHeader",
11883 #endif
11884  .namespaceZero = true,
11885  .padding = 0,
11886  .isArray = false
11887  },
11888  { .memberTypeIndex = UA_TYPES_ENDPOINTDESCRIPTION,
11889 #ifdef UA_ENABLE_TYPENAMES
11890  .memberName = "endpoints",
11891 #endif
11892  .namespaceZero = true,
11893  .padding = offsetof(UA_GetEndpointsResponse, endpointsSize) - offsetof(UA_GetEndpointsResponse, responseHeader) - sizeof(UA_ResponseHeader),
11894  .isArray = true
11895  },};
11896 
11897 /* NodeTypeDescription */
11898 static UA_DataTypeMember NodeTypeDescription_members[3] = {
11900 #ifdef UA_ENABLE_TYPENAMES
11901  .memberName = "typeDefinitionNode",
11902 #endif
11903  .namespaceZero = true,
11904  .padding = 0,
11905  .isArray = false
11906  },
11907  { .memberTypeIndex = UA_TYPES_BOOLEAN,
11908 #ifdef UA_ENABLE_TYPENAMES
11909  .memberName = "includeSubTypes",
11910 #endif
11911  .namespaceZero = true,
11912  .padding = offsetof(UA_NodeTypeDescription, includeSubTypes) - offsetof(UA_NodeTypeDescription, typeDefinitionNode) - sizeof(UA_ExpandedNodeId),
11913  .isArray = false
11914  },
11915  { .memberTypeIndex = UA_TYPES_QUERYDATADESCRIPTION,
11916 #ifdef UA_ENABLE_TYPENAMES
11917  .memberName = "dataToReturn",
11918 #endif
11919  .namespaceZero = true,
11920  .padding = offsetof(UA_NodeTypeDescription, dataToReturnSize) - offsetof(UA_NodeTypeDescription, includeSubTypes) - sizeof(UA_Boolean),
11921  .isArray = true
11922  },};
11923 
11924 /* BrowseNextResponse */
11925 static UA_DataTypeMember BrowseNextResponse_members[3] = {
11927 #ifdef UA_ENABLE_TYPENAMES
11928  .memberName = "responseHeader",
11929 #endif
11930  .namespaceZero = true,
11931  .padding = 0,
11932  .isArray = false
11933  },
11934  { .memberTypeIndex = UA_TYPES_BROWSERESULT,
11935 #ifdef UA_ENABLE_TYPENAMES
11936  .memberName = "results",
11937 #endif
11938  .namespaceZero = true,
11939  .padding = offsetof(UA_BrowseNextResponse, resultsSize) - offsetof(UA_BrowseNextResponse, responseHeader) - sizeof(UA_ResponseHeader),
11940  .isArray = true
11941  },
11942  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11943 #ifdef UA_ENABLE_TYPENAMES
11944  .memberName = "diagnosticInfos",
11945 #endif
11946  .namespaceZero = true,
11947  .padding = offsetof(UA_BrowseNextResponse, diagnosticInfosSize) - offsetof(UA_BrowseNextResponse, results) - sizeof(void*),
11948  .isArray = true
11949  },};
11950 
11951 /* TranslateBrowsePathsToNodeIdsRequest */
11952 static UA_DataTypeMember TranslateBrowsePathsToNodeIdsRequest_members[2] = {
11954 #ifdef UA_ENABLE_TYPENAMES
11955  .memberName = "requestHeader",
11956 #endif
11957  .namespaceZero = true,
11958  .padding = 0,
11959  .isArray = false
11960  },
11961  { .memberTypeIndex = UA_TYPES_BROWSEPATH,
11962 #ifdef UA_ENABLE_TYPENAMES
11963  .memberName = "browsePaths",
11964 #endif
11965  .namespaceZero = true,
11966  .padding = offsetof(UA_TranslateBrowsePathsToNodeIdsRequest, browsePathsSize) - offsetof(UA_TranslateBrowsePathsToNodeIdsRequest, requestHeader) - sizeof(UA_RequestHeader),
11967  .isArray = true
11968  },};
11969 
11970 /* BrowseResponse */
11971 static UA_DataTypeMember BrowseResponse_members[3] = {
11973 #ifdef UA_ENABLE_TYPENAMES
11974  .memberName = "responseHeader",
11975 #endif
11976  .namespaceZero = true,
11977  .padding = 0,
11978  .isArray = false
11979  },
11980  { .memberTypeIndex = UA_TYPES_BROWSERESULT,
11981 #ifdef UA_ENABLE_TYPENAMES
11982  .memberName = "results",
11983 #endif
11984  .namespaceZero = true,
11985  .padding = offsetof(UA_BrowseResponse, resultsSize) - offsetof(UA_BrowseResponse, responseHeader) - sizeof(UA_ResponseHeader),
11986  .isArray = true
11987  },
11988  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11989 #ifdef UA_ENABLE_TYPENAMES
11990  .memberName = "diagnosticInfos",
11991 #endif
11992  .namespaceZero = true,
11993  .padding = offsetof(UA_BrowseResponse, diagnosticInfosSize) - offsetof(UA_BrowseResponse, results) - sizeof(void*),
11994  .isArray = true
11995  },};
11996 
11997 /* CreateSessionResponse */
11998 static UA_DataTypeMember CreateSessionResponse_members[10] = {
12000 #ifdef UA_ENABLE_TYPENAMES
12001  .memberName = "responseHeader",
12002 #endif
12003  .namespaceZero = true,
12004  .padding = 0,
12005  .isArray = false
12006  },
12007  { .memberTypeIndex = UA_TYPES_NODEID,
12008 #ifdef UA_ENABLE_TYPENAMES
12009  .memberName = "sessionId",
12010 #endif
12011  .namespaceZero = true,
12012  .padding = offsetof(UA_CreateSessionResponse, sessionId) - offsetof(UA_CreateSessionResponse, responseHeader) - sizeof(UA_ResponseHeader),
12013  .isArray = false
12014  },
12015  { .memberTypeIndex = UA_TYPES_NODEID,
12016 #ifdef UA_ENABLE_TYPENAMES
12017  .memberName = "authenticationToken",
12018 #endif
12019  .namespaceZero = true,
12020  .padding = offsetof(UA_CreateSessionResponse, authenticationToken) - offsetof(UA_CreateSessionResponse, sessionId) - sizeof(UA_NodeId),
12021  .isArray = false
12022  },
12023  { .memberTypeIndex = UA_TYPES_DOUBLE,
12024 #ifdef UA_ENABLE_TYPENAMES
12025  .memberName = "revisedSessionTimeout",
12026 #endif
12027  .namespaceZero = true,
12028  .padding = offsetof(UA_CreateSessionResponse, revisedSessionTimeout) - offsetof(UA_CreateSessionResponse, authenticationToken) - sizeof(UA_NodeId),
12029  .isArray = false
12030  },
12031  { .memberTypeIndex = UA_TYPES_BYTESTRING,
12032 #ifdef UA_ENABLE_TYPENAMES
12033  .memberName = "serverNonce",
12034 #endif
12035  .namespaceZero = true,
12036  .padding = offsetof(UA_CreateSessionResponse, serverNonce) - offsetof(UA_CreateSessionResponse, revisedSessionTimeout) - sizeof(UA_Double),
12037  .isArray = false
12038  },
12039  { .memberTypeIndex = UA_TYPES_BYTESTRING,
12040 #ifdef UA_ENABLE_TYPENAMES
12041  .memberName = "serverCertificate",
12042 #endif
12043  .namespaceZero = true,
12044  .padding = offsetof(UA_CreateSessionResponse, serverCertificate) - offsetof(UA_CreateSessionResponse, serverNonce) - sizeof(UA_ByteString),
12045  .isArray = false
12046  },
12047  { .memberTypeIndex = UA_TYPES_ENDPOINTDESCRIPTION,
12048 #ifdef UA_ENABLE_TYPENAMES
12049  .memberName = "serverEndpoints",
12050 #endif
12051  .namespaceZero = true,
12052  .padding = offsetof(UA_CreateSessionResponse, serverEndpointsSize) - offsetof(UA_CreateSessionResponse, serverCertificate) - sizeof(UA_ByteString),
12053  .isArray = true
12054  },
12055  { .memberTypeIndex = UA_TYPES_SIGNEDSOFTWARECERTIFICATE,
12056 #ifdef UA_ENABLE_TYPENAMES
12057  .memberName = "serverSoftwareCertificates",
12058 #endif
12059  .namespaceZero = true,
12060  .padding = offsetof(UA_CreateSessionResponse, serverSoftwareCertificatesSize) - offsetof(UA_CreateSessionResponse, serverEndpoints) - sizeof(void*),
12061  .isArray = true
12062  },
12063  { .memberTypeIndex = UA_TYPES_SIGNATUREDATA,
12064 #ifdef UA_ENABLE_TYPENAMES
12065  .memberName = "serverSignature",
12066 #endif
12067  .namespaceZero = true,
12068  .padding = offsetof(UA_CreateSessionResponse, serverSignature) - offsetof(UA_CreateSessionResponse, serverSoftwareCertificates) - sizeof(void*),
12069  .isArray = false
12070  },
12071  { .memberTypeIndex = UA_TYPES_UINT32,
12072 #ifdef UA_ENABLE_TYPENAMES
12073  .memberName = "maxRequestMessageSize",
12074 #endif
12075  .namespaceZero = true,
12076  .padding = offsetof(UA_CreateSessionResponse, maxRequestMessageSize) - offsetof(UA_CreateSessionResponse, serverSignature) - sizeof(UA_SignatureData),
12077  .isArray = false
12078  },};
12079 
12080 /* QueryFirstRequest */
12081 static UA_DataTypeMember QueryFirstRequest_members[6] = {
12083 #ifdef UA_ENABLE_TYPENAMES
12084  .memberName = "requestHeader",
12085 #endif
12086  .namespaceZero = true,
12087  .padding = 0,
12088  .isArray = false
12089  },
12090  { .memberTypeIndex = UA_TYPES_VIEWDESCRIPTION,
12091 #ifdef UA_ENABLE_TYPENAMES
12092  .memberName = "view",
12093 #endif
12094  .namespaceZero = true,
12095  .padding = offsetof(UA_QueryFirstRequest, view) - offsetof(UA_QueryFirstRequest, requestHeader) - sizeof(UA_RequestHeader),
12096  .isArray = false
12097  },
12098  { .memberTypeIndex = UA_TYPES_NODETYPEDESCRIPTION,
12099 #ifdef UA_ENABLE_TYPENAMES
12100  .memberName = "nodeTypes",
12101 #endif
12102  .namespaceZero = true,
12103  .padding = offsetof(UA_QueryFirstRequest, nodeTypesSize) - offsetof(UA_QueryFirstRequest, view) - sizeof(UA_ViewDescription),
12104  .isArray = true
12105  },
12106  { .memberTypeIndex = UA_TYPES_CONTENTFILTER,
12107 #ifdef UA_ENABLE_TYPENAMES
12108  .memberName = "filter",
12109 #endif
12110  .namespaceZero = true,
12111  .padding = offsetof(UA_QueryFirstRequest, filter) - offsetof(UA_QueryFirstRequest, nodeTypes) - sizeof(void*),
12112  .isArray = false
12113  },
12114  { .memberTypeIndex = UA_TYPES_UINT32,
12115 #ifdef UA_ENABLE_TYPENAMES
12116  .memberName = "maxDataSetsToReturn",
12117 #endif
12118  .namespaceZero = true,
12119  .padding = offsetof(UA_QueryFirstRequest, maxDataSetsToReturn) - offsetof(UA_QueryFirstRequest, filter) - sizeof(UA_ContentFilter),
12120  .isArray = false
12121  },
12122  { .memberTypeIndex = UA_TYPES_UINT32,
12123 #ifdef UA_ENABLE_TYPENAMES
12124  .memberName = "maxReferencesToReturn",
12125 #endif
12126  .namespaceZero = true,
12127  .padding = offsetof(UA_QueryFirstRequest, maxReferencesToReturn) - offsetof(UA_QueryFirstRequest, maxDataSetsToReturn) - sizeof(UA_UInt32),
12128  .isArray = false
12129  },};
12131 
12132 /* Boolean */
12133 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 1},
12134  .typeIndex = UA_TYPES_BOOLEAN,
12135 #ifdef UA_ENABLE_TYPENAMES
12136  .typeName = "Boolean",
12137 #endif
12138  .memSize = sizeof(UA_Boolean),
12139  .builtin = true,
12140  .fixedSize = true,
12141  .overlayable = true,
12142  .binaryEncodingId = 0,
12143  .membersSize = 1,
12144  .members = Boolean_members },
12145 
12146 /* SByte */
12147 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 2},
12148  .typeIndex = UA_TYPES_SBYTE,
12149 #ifdef UA_ENABLE_TYPENAMES
12150  .typeName = "SByte",
12151 #endif
12152  .memSize = sizeof(UA_SByte),
12153  .builtin = true,
12154  .fixedSize = true,
12155  .overlayable = true,
12156  .binaryEncodingId = 0,
12157  .membersSize = 1,
12158  .members = SByte_members },
12159 
12160 /* Byte */
12161 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 3},
12162  .typeIndex = UA_TYPES_BYTE,
12163 #ifdef UA_ENABLE_TYPENAMES
12164  .typeName = "Byte",
12165 #endif
12166  .memSize = sizeof(UA_Byte),
12167  .builtin = true,
12168  .fixedSize = true,
12169  .overlayable = true,
12170  .binaryEncodingId = 0,
12171  .membersSize = 1,
12172  .members = Byte_members },
12173 
12174 /* Int16 */
12175 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 4},
12176  .typeIndex = UA_TYPES_INT16,
12177 #ifdef UA_ENABLE_TYPENAMES
12178  .typeName = "Int16",
12179 #endif
12180  .memSize = sizeof(UA_Int16),
12181  .builtin = true,
12182  .fixedSize = true,
12183  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12184  .binaryEncodingId = 0,
12185  .membersSize = 1,
12186  .members = Int16_members },
12187 
12188 /* UInt16 */
12189 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 5},
12190  .typeIndex = UA_TYPES_UINT16,
12191 #ifdef UA_ENABLE_TYPENAMES
12192  .typeName = "UInt16",
12193 #endif
12194  .memSize = sizeof(UA_UInt16),
12195  .builtin = true,
12196  .fixedSize = true,
12197  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12198  .binaryEncodingId = 0,
12199  .membersSize = 1,
12200  .members = UInt16_members },
12201 
12202 /* Int32 */
12203 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12204  .typeIndex = UA_TYPES_INT32,
12205 #ifdef UA_ENABLE_TYPENAMES
12206  .typeName = "Int32",
12207 #endif
12208  .memSize = sizeof(UA_Int32),
12209  .builtin = true,
12210  .fixedSize = true,
12211  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12212  .binaryEncodingId = 0,
12213  .membersSize = 1,
12214  .members = Int32_members },
12215 
12216 /* UInt32 */
12217 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 7},
12218  .typeIndex = UA_TYPES_UINT32,
12219 #ifdef UA_ENABLE_TYPENAMES
12220  .typeName = "UInt32",
12221 #endif
12222  .memSize = sizeof(UA_UInt32),
12223  .builtin = true,
12224  .fixedSize = true,
12225  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12226  .binaryEncodingId = 0,
12227  .membersSize = 1,
12228  .members = UInt32_members },
12229 
12230 /* Int64 */
12231 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 8},
12232  .typeIndex = UA_TYPES_INT64,
12233 #ifdef UA_ENABLE_TYPENAMES
12234  .typeName = "Int64",
12235 #endif
12236  .memSize = sizeof(UA_Int64),
12237  .builtin = true,
12238  .fixedSize = true,
12239  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12240  .binaryEncodingId = 0,
12241  .membersSize = 1,
12242  .members = Int64_members },
12243 
12244 /* UInt64 */
12245 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 9},
12246  .typeIndex = UA_TYPES_UINT64,
12247 #ifdef UA_ENABLE_TYPENAMES
12248  .typeName = "UInt64",
12249 #endif
12250  .memSize = sizeof(UA_UInt64),
12251  .builtin = true,
12252  .fixedSize = true,
12253  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12254  .binaryEncodingId = 0,
12255  .membersSize = 1,
12256  .members = UInt64_members },
12257 
12258 /* Float */
12259 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 10},
12260  .typeIndex = UA_TYPES_FLOAT,
12261 #ifdef UA_ENABLE_TYPENAMES
12262  .typeName = "Float",
12263 #endif
12264  .memSize = sizeof(UA_Float),
12265  .builtin = true,
12266  .fixedSize = true,
12267  .overlayable = UA_BINARY_OVERLAYABLE_FLOAT,
12268  .binaryEncodingId = 0,
12269  .membersSize = 1,
12270  .members = Float_members },
12271 
12272 /* Double */
12273 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 11},
12274  .typeIndex = UA_TYPES_DOUBLE,
12275 #ifdef UA_ENABLE_TYPENAMES
12276  .typeName = "Double",
12277 #endif
12278  .memSize = sizeof(UA_Double),
12279  .builtin = true,
12280  .fixedSize = true,
12281  .overlayable = UA_BINARY_OVERLAYABLE_FLOAT,
12282  .binaryEncodingId = 0,
12283  .membersSize = 1,
12284  .members = Double_members },
12285 
12286 /* String */
12287 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 12},
12288  .typeIndex = UA_TYPES_STRING,
12289 #ifdef UA_ENABLE_TYPENAMES
12290  .typeName = "String",
12291 #endif
12292  .memSize = sizeof(UA_String),
12293  .builtin = true,
12294  .fixedSize = false,
12295  .overlayable = false,
12296  .binaryEncodingId = 0,
12297  .membersSize = 1,
12298  .members = String_members },
12299 
12300 /* DateTime */
12301 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 13},
12302  .typeIndex = UA_TYPES_DATETIME,
12303 #ifdef UA_ENABLE_TYPENAMES
12304  .typeName = "DateTime",
12305 #endif
12306  .memSize = sizeof(UA_DateTime),
12307  .builtin = true,
12308  .fixedSize = true,
12309  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12310  .binaryEncodingId = 0,
12311  .membersSize = 1,
12312  .members = DateTime_members },
12313 
12314 /* Guid */
12315 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 14},
12316  .typeIndex = UA_TYPES_GUID,
12317 #ifdef UA_ENABLE_TYPENAMES
12318  .typeName = "Guid",
12319 #endif
12320  .memSize = sizeof(UA_Guid),
12321  .builtin = true,
12322  .fixedSize = true,
12323  .overlayable = (UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_Guid, data2) == sizeof(UA_UInt32) && offsetof(UA_Guid, data3) == (sizeof(UA_UInt16) + sizeof(UA_UInt32)) && offsetof(UA_Guid, data4) == (2*sizeof(UA_UInt32))),
12324  .binaryEncodingId = 0,
12325  .membersSize = 1,
12326  .members = Guid_members },
12327 
12328 /* ByteString */
12329 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 15},
12330  .typeIndex = UA_TYPES_BYTESTRING,
12331 #ifdef UA_ENABLE_TYPENAMES
12332  .typeName = "ByteString",
12333 #endif
12334  .memSize = sizeof(UA_ByteString),
12335  .builtin = true,
12336  .fixedSize = false,
12337  .overlayable = false,
12338  .binaryEncodingId = 0,
12339  .membersSize = 1,
12340  .members = ByteString_members },
12341 
12342 /* XmlElement */
12343 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 16},
12344  .typeIndex = UA_TYPES_XMLELEMENT,
12345 #ifdef UA_ENABLE_TYPENAMES
12346  .typeName = "XmlElement",
12347 #endif
12348  .memSize = sizeof(UA_XmlElement),
12349  .builtin = true,
12350  .fixedSize = false,
12351  .overlayable = false,
12352  .binaryEncodingId = 0,
12353  .membersSize = 1,
12354  .members = XmlElement_members },
12355 
12356 /* NodeId */
12357 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 17},
12358  .typeIndex = UA_TYPES_NODEID,
12359 #ifdef UA_ENABLE_TYPENAMES
12360  .typeName = "NodeId",
12361 #endif
12362  .memSize = sizeof(UA_NodeId),
12363  .builtin = true,
12364  .fixedSize = false,
12365  .overlayable = false,
12366  .binaryEncodingId = 0,
12367  .membersSize = 1,
12368  .members = NodeId_members },
12369 
12370 /* ExpandedNodeId */
12371 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 18},
12372  .typeIndex = UA_TYPES_EXPANDEDNODEID,
12373 #ifdef UA_ENABLE_TYPENAMES
12374  .typeName = "ExpandedNodeId",
12375 #endif
12376  .memSize = sizeof(UA_ExpandedNodeId),
12377  .builtin = true,
12378  .fixedSize = false,
12379  .overlayable = false,
12380  .binaryEncodingId = 0,
12381  .membersSize = 1,
12382  .members = ExpandedNodeId_members },
12383 
12384 /* StatusCode */
12385 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 19},
12386  .typeIndex = UA_TYPES_STATUSCODE,
12387 #ifdef UA_ENABLE_TYPENAMES
12388  .typeName = "StatusCode",
12389 #endif
12390  .memSize = sizeof(UA_StatusCode),
12391  .builtin = true,
12392  .fixedSize = true,
12393  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12394  .binaryEncodingId = 0,
12395  .membersSize = 1,
12396  .members = StatusCode_members },
12397 
12398 /* QualifiedName */
12399 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 20},
12400  .typeIndex = UA_TYPES_QUALIFIEDNAME,
12401 #ifdef UA_ENABLE_TYPENAMES
12402  .typeName = "QualifiedName",
12403 #endif
12404  .memSize = sizeof(UA_QualifiedName),
12405  .builtin = true,
12406  .fixedSize = false,
12407  .overlayable = false,
12408  .binaryEncodingId = 0,
12409  .membersSize = 2,
12410  .members = QualifiedName_members },
12411 
12412 /* LocalizedText */
12413 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 21},
12414  .typeIndex = UA_TYPES_LOCALIZEDTEXT,
12415 #ifdef UA_ENABLE_TYPENAMES
12416  .typeName = "LocalizedText",
12417 #endif
12418  .memSize = sizeof(UA_LocalizedText),
12419  .builtin = true,
12420  .fixedSize = false,
12421  .overlayable = false,
12422  .binaryEncodingId = 0,
12423  .membersSize = 1,
12424  .members = LocalizedText_members },
12425 
12426 /* ExtensionObject */
12427 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 22},
12428  .typeIndex = UA_TYPES_EXTENSIONOBJECT,
12429 #ifdef UA_ENABLE_TYPENAMES
12430  .typeName = "ExtensionObject",
12431 #endif
12432  .memSize = sizeof(UA_ExtensionObject),
12433  .builtin = true,
12434  .fixedSize = false,
12435  .overlayable = false,
12436  .binaryEncodingId = 0,
12437  .membersSize = 1,
12438  .members = ExtensionObject_members },
12439 
12440 /* DataValue */
12441 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 23},
12442  .typeIndex = UA_TYPES_DATAVALUE,
12443 #ifdef UA_ENABLE_TYPENAMES
12444  .typeName = "DataValue",
12445 #endif
12446  .memSize = sizeof(UA_DataValue),
12447  .builtin = true,
12448  .fixedSize = false,
12449  .overlayable = false,
12450  .binaryEncodingId = 0,
12451  .membersSize = 1,
12452  .members = DataValue_members },
12453 
12454 /* Variant */
12455 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 24},
12456  .typeIndex = UA_TYPES_VARIANT,
12457 #ifdef UA_ENABLE_TYPENAMES
12458  .typeName = "Variant",
12459 #endif
12460  .memSize = sizeof(UA_Variant),
12461  .builtin = true,
12462  .fixedSize = false,
12463  .overlayable = false,
12464  .binaryEncodingId = 0,
12465  .membersSize = 1,
12466  .members = Variant_members },
12467 
12468 /* DiagnosticInfo */
12469 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 25},
12470  .typeIndex = UA_TYPES_DIAGNOSTICINFO,
12471 #ifdef UA_ENABLE_TYPENAMES
12472  .typeName = "DiagnosticInfo",
12473 #endif
12474  .memSize = sizeof(UA_DiagnosticInfo),
12475  .builtin = true,
12476  .fixedSize = false,
12477  .overlayable = false,
12478  .binaryEncodingId = 0,
12479  .membersSize = 1,
12480  .members = DiagnosticInfo_members },
12481 
12482 /* SignedSoftwareCertificate */
12483 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 344},
12485 #ifdef UA_ENABLE_TYPENAMES
12486  .typeName = "SignedSoftwareCertificate",
12487 #endif
12488  .memSize = sizeof(UA_SignedSoftwareCertificate),
12489  .builtin = false,
12490  .fixedSize = false,
12491  .overlayable = false,
12492  .binaryEncodingId = 346,
12493  .membersSize = 2,
12494  .members = SignedSoftwareCertificate_members },
12495 
12496 /* BrowsePathTarget */
12497 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 546},
12498  .typeIndex = UA_TYPES_BROWSEPATHTARGET,
12499 #ifdef UA_ENABLE_TYPENAMES
12500  .typeName = "BrowsePathTarget",
12501 #endif
12502  .memSize = sizeof(UA_BrowsePathTarget),
12503  .builtin = false,
12504  .fixedSize = false,
12505  .overlayable = false,
12506  .binaryEncodingId = 548,
12507  .membersSize = 2,
12508  .members = BrowsePathTarget_members },
12509 
12510 /* ViewAttributes */
12511 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 373},
12512  .typeIndex = UA_TYPES_VIEWATTRIBUTES,
12513 #ifdef UA_ENABLE_TYPENAMES
12514  .typeName = "ViewAttributes",
12515 #endif
12516  .memSize = sizeof(UA_ViewAttributes),
12517  .builtin = false,
12518  .fixedSize = false,
12519  .overlayable = false,
12520  .binaryEncodingId = 375,
12521  .membersSize = 7,
12522  .members = ViewAttributes_members },
12523 
12524 /* BrowseResultMask */
12525 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12526  .typeIndex = UA_TYPES_INT32,
12527 #ifdef UA_ENABLE_TYPENAMES
12528  .typeName = "BrowseResultMask",
12529 #endif
12530  .memSize = sizeof(UA_BrowseResultMask),
12531  .builtin = true,
12532  .fixedSize = true,
12533  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12534  .binaryEncodingId = 0,
12535  .membersSize = 1,
12536  .members = BrowseResultMask_members },
12537 
12538 /* RequestHeader */
12539 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 389},
12540  .typeIndex = UA_TYPES_REQUESTHEADER,
12541 #ifdef UA_ENABLE_TYPENAMES
12542  .typeName = "RequestHeader",
12543 #endif
12544  .memSize = sizeof(UA_RequestHeader),
12545  .builtin = false,
12546  .fixedSize = false,
12547  .overlayable = false,
12548  .binaryEncodingId = 391,
12549  .membersSize = 7,
12550  .members = RequestHeader_members },
12551 
12552 /* MonitoredItemModifyResult */
12553 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 758},
12555 #ifdef UA_ENABLE_TYPENAMES
12556  .typeName = "MonitoredItemModifyResult",
12557 #endif
12558  .memSize = sizeof(UA_MonitoredItemModifyResult),
12559  .builtin = false,
12560  .fixedSize = false,
12561  .overlayable = false,
12562  .binaryEncodingId = 760,
12563  .membersSize = 4,
12564  .members = MonitoredItemModifyResult_members },
12565 
12566 /* CloseSecureChannelRequest */
12567 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 450},
12569 #ifdef UA_ENABLE_TYPENAMES
12570  .typeName = "CloseSecureChannelRequest",
12571 #endif
12572  .memSize = sizeof(UA_CloseSecureChannelRequest),
12573  .builtin = false,
12574  .fixedSize = false,
12575  .overlayable = false,
12576  .binaryEncodingId = 452,
12577  .membersSize = 1,
12578  .members = CloseSecureChannelRequest_members },
12579 
12580 /* AddNodesResult */
12581 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 483},
12582  .typeIndex = UA_TYPES_ADDNODESRESULT,
12583 #ifdef UA_ENABLE_TYPENAMES
12584  .typeName = "AddNodesResult",
12585 #endif
12586  .memSize = sizeof(UA_AddNodesResult),
12587  .builtin = false,
12588  .fixedSize = false,
12589  .overlayable = false,
12590  .binaryEncodingId = 485,
12591  .membersSize = 2,
12592  .members = AddNodesResult_members },
12593 
12594 /* VariableAttributes */
12595 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 355},
12596  .typeIndex = UA_TYPES_VARIABLEATTRIBUTES,
12597 #ifdef UA_ENABLE_TYPENAMES
12598  .typeName = "VariableAttributes",
12599 #endif
12600  .memSize = sizeof(UA_VariableAttributes),
12601  .builtin = false,
12602  .fixedSize = false,
12603  .overlayable = false,
12604  .binaryEncodingId = 357,
12605  .membersSize = 13,
12606  .members = VariableAttributes_members },
12607 
12608 /* NotificationMessage */
12609 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 803},
12610  .typeIndex = UA_TYPES_NOTIFICATIONMESSAGE,
12611 #ifdef UA_ENABLE_TYPENAMES
12612  .typeName = "NotificationMessage",
12613 #endif
12614  .memSize = sizeof(UA_NotificationMessage),
12615  .builtin = false,
12616  .fixedSize = false,
12617  .overlayable = false,
12618  .binaryEncodingId = 805,
12619  .membersSize = 3,
12620  .members = NotificationMessage_members },
12621 
12622 /* NodeAttributesMask */
12623 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12624  .typeIndex = UA_TYPES_INT32,
12625 #ifdef UA_ENABLE_TYPENAMES
12626  .typeName = "NodeAttributesMask",
12627 #endif
12628  .memSize = sizeof(UA_NodeAttributesMask),
12629  .builtin = true,
12630  .fixedSize = true,
12631  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12632  .binaryEncodingId = 0,
12633  .membersSize = 1,
12634  .members = NodeAttributesMask_members },
12635 
12636 /* MonitoringMode */
12637 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12638  .typeIndex = UA_TYPES_INT32,
12639 #ifdef UA_ENABLE_TYPENAMES
12640  .typeName = "MonitoringMode",
12641 #endif
12642  .memSize = sizeof(UA_MonitoringMode),
12643  .builtin = true,
12644  .fixedSize = true,
12645  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12646  .binaryEncodingId = 0,
12647  .membersSize = 1,
12648  .members = MonitoringMode_members },
12649 
12650 /* CallMethodResult */
12651 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 707},
12652  .typeIndex = UA_TYPES_CALLMETHODRESULT,
12653 #ifdef UA_ENABLE_TYPENAMES
12654  .typeName = "CallMethodResult",
12655 #endif
12656  .memSize = sizeof(UA_CallMethodResult),
12657  .builtin = false,
12658  .fixedSize = false,
12659  .overlayable = false,
12660  .binaryEncodingId = 709,
12661  .membersSize = 4,
12662  .members = CallMethodResult_members },
12663 
12664 /* ParsingResult */
12665 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 610},
12666  .typeIndex = UA_TYPES_PARSINGRESULT,
12667 #ifdef UA_ENABLE_TYPENAMES
12668  .typeName = "ParsingResult",
12669 #endif
12670  .memSize = sizeof(UA_ParsingResult),
12671  .builtin = false,
12672  .fixedSize = false,
12673  .overlayable = false,
12674  .binaryEncodingId = 612,
12675  .membersSize = 3,
12676  .members = ParsingResult_members },
12677 
12678 /* RelativePathElement */
12679 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 537},
12680  .typeIndex = UA_TYPES_RELATIVEPATHELEMENT,
12681 #ifdef UA_ENABLE_TYPENAMES
12682  .typeName = "RelativePathElement",
12683 #endif
12684  .memSize = sizeof(UA_RelativePathElement),
12685  .builtin = false,
12686  .fixedSize = false,
12687  .overlayable = false,
12688  .binaryEncodingId = 539,
12689  .membersSize = 4,
12690  .members = RelativePathElement_members },
12691 
12692 /* BrowseDirection */
12693 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12694  .typeIndex = UA_TYPES_INT32,
12695 #ifdef UA_ENABLE_TYPENAMES
12696  .typeName = "BrowseDirection",
12697 #endif
12698  .memSize = sizeof(UA_BrowseDirection),
12699  .builtin = true,
12700  .fixedSize = true,
12701  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12702  .binaryEncodingId = 0,
12703  .membersSize = 1,
12704  .members = BrowseDirection_members },
12705 
12706 /* CallMethodRequest */
12707 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 704},
12708  .typeIndex = UA_TYPES_CALLMETHODREQUEST,
12709 #ifdef UA_ENABLE_TYPENAMES
12710  .typeName = "CallMethodRequest",
12711 #endif
12712  .memSize = sizeof(UA_CallMethodRequest),
12713  .builtin = false,
12714  .fixedSize = false,
12715  .overlayable = false,
12716  .binaryEncodingId = 706,
12717  .membersSize = 3,
12718  .members = CallMethodRequest_members },
12719 
12720 /* UnregisterNodesRequest */
12721 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 564},
12722  .typeIndex = UA_TYPES_UNREGISTERNODESREQUEST,
12723 #ifdef UA_ENABLE_TYPENAMES
12724  .typeName = "UnregisterNodesRequest",
12725 #endif
12726  .memSize = sizeof(UA_UnregisterNodesRequest),
12727  .builtin = false,
12728  .fixedSize = false,
12729  .overlayable = false,
12730  .binaryEncodingId = 566,
12731  .membersSize = 2,
12732  .members = UnregisterNodesRequest_members },
12733 
12734 /* ContentFilterElementResult */
12735 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 604},
12737 #ifdef UA_ENABLE_TYPENAMES
12738  .typeName = "ContentFilterElementResult",
12739 #endif
12740  .memSize = sizeof(UA_ContentFilterElementResult),
12741  .builtin = false,
12742  .fixedSize = false,
12743  .overlayable = false,
12744  .binaryEncodingId = 606,
12745  .membersSize = 3,
12746  .members = ContentFilterElementResult_members },
12747 
12748 /* QueryDataSet */
12749 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 577},
12750  .typeIndex = UA_TYPES_QUERYDATASET,
12751 #ifdef UA_ENABLE_TYPENAMES
12752  .typeName = "QueryDataSet",
12753 #endif
12754  .memSize = sizeof(UA_QueryDataSet),
12755  .builtin = false,
12756  .fixedSize = false,
12757  .overlayable = false,
12758  .binaryEncodingId = 579,
12759  .membersSize = 3,
12760  .members = QueryDataSet_members },
12761 
12762 /* AnonymousIdentityToken */
12763 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 319},
12764  .typeIndex = UA_TYPES_ANONYMOUSIDENTITYTOKEN,
12765 #ifdef UA_ENABLE_TYPENAMES
12766  .typeName = "AnonymousIdentityToken",
12767 #endif
12768  .memSize = sizeof(UA_AnonymousIdentityToken),
12769  .builtin = false,
12770  .fixedSize = false,
12771  .overlayable = false,
12772  .binaryEncodingId = 321,
12773  .membersSize = 1,
12774  .members = AnonymousIdentityToken_members },
12775 
12776 /* SetPublishingModeRequest */
12777 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 797},
12778  .typeIndex = UA_TYPES_SETPUBLISHINGMODEREQUEST,
12779 #ifdef UA_ENABLE_TYPENAMES
12780  .typeName = "SetPublishingModeRequest",
12781 #endif
12782  .memSize = sizeof(UA_SetPublishingModeRequest),
12783  .builtin = false,
12784  .fixedSize = false,
12785  .overlayable = false,
12786  .binaryEncodingId = 799,
12787  .membersSize = 3,
12788  .members = SetPublishingModeRequest_members },
12789 
12790 /* TimestampsToReturn */
12791 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12792  .typeIndex = UA_TYPES_INT32,
12793 #ifdef UA_ENABLE_TYPENAMES
12794  .typeName = "TimestampsToReturn",
12795 #endif
12796  .memSize = sizeof(UA_TimestampsToReturn),
12797  .builtin = true,
12798  .fixedSize = true,
12799  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12800  .binaryEncodingId = 0,
12801  .membersSize = 1,
12802  .members = TimestampsToReturn_members },
12803 
12804 /* CallRequest */
12805 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 710},
12806  .typeIndex = UA_TYPES_CALLREQUEST,
12807 #ifdef UA_ENABLE_TYPENAMES
12808  .typeName = "CallRequest",
12809 #endif
12810  .memSize = sizeof(UA_CallRequest),
12811  .builtin = false,
12812  .fixedSize = false,
12813  .overlayable = false,
12814  .binaryEncodingId = 712,
12815  .membersSize = 2,
12816  .members = CallRequest_members },
12817 
12818 /* MethodAttributes */
12819 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 358},
12820  .typeIndex = UA_TYPES_METHODATTRIBUTES,
12821 #ifdef UA_ENABLE_TYPENAMES
12822  .typeName = "MethodAttributes",
12823 #endif
12824  .memSize = sizeof(UA_MethodAttributes),
12825  .builtin = false,
12826  .fixedSize = false,
12827  .overlayable = false,
12828  .binaryEncodingId = 360,
12829  .membersSize = 7,
12830  .members = MethodAttributes_members },
12831 
12832 /* DeleteReferencesItem */
12833 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 385},
12834  .typeIndex = UA_TYPES_DELETEREFERENCESITEM,
12835 #ifdef UA_ENABLE_TYPENAMES
12836  .typeName = "DeleteReferencesItem",
12837 #endif
12838  .memSize = sizeof(UA_DeleteReferencesItem),
12839  .builtin = false,
12840  .fixedSize = false,
12841  .overlayable = false,
12842  .binaryEncodingId = 387,
12843  .membersSize = 5,
12844  .members = DeleteReferencesItem_members },
12845 
12846 /* WriteValue */
12847 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 668},
12848  .typeIndex = UA_TYPES_WRITEVALUE,
12849 #ifdef UA_ENABLE_TYPENAMES
12850  .typeName = "WriteValue",
12851 #endif
12852  .memSize = sizeof(UA_WriteValue),
12853  .builtin = false,
12854  .fixedSize = false,
12855  .overlayable = false,
12856  .binaryEncodingId = 670,
12857  .membersSize = 4,
12858  .members = WriteValue_members },
12859 
12860 /* MonitoredItemCreateResult */
12861 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 746},
12863 #ifdef UA_ENABLE_TYPENAMES
12864  .typeName = "MonitoredItemCreateResult",
12865 #endif
12866  .memSize = sizeof(UA_MonitoredItemCreateResult),
12867  .builtin = false,
12868  .fixedSize = false,
12869  .overlayable = false,
12870  .binaryEncodingId = 748,
12871  .membersSize = 5,
12872  .members = MonitoredItemCreateResult_members },
12873 
12874 /* MessageSecurityMode */
12875 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12876  .typeIndex = UA_TYPES_INT32,
12877 #ifdef UA_ENABLE_TYPENAMES
12878  .typeName = "MessageSecurityMode",
12879 #endif
12880  .memSize = sizeof(UA_MessageSecurityMode),
12881  .builtin = true,
12882  .fixedSize = true,
12883  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12884  .binaryEncodingId = 0,
12885  .membersSize = 1,
12886  .members = MessageSecurityMode_members },
12887 
12888 /* MonitoringParameters */
12889 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 740},
12890  .typeIndex = UA_TYPES_MONITORINGPARAMETERS,
12891 #ifdef UA_ENABLE_TYPENAMES
12892  .typeName = "MonitoringParameters",
12893 #endif
12894  .memSize = sizeof(UA_MonitoringParameters),
12895  .builtin = false,
12896  .fixedSize = false,
12897  .overlayable = false,
12898  .binaryEncodingId = 742,
12899  .membersSize = 5,
12900  .members = MonitoringParameters_members },
12901 
12902 /* SignatureData */
12903 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 456},
12904  .typeIndex = UA_TYPES_SIGNATUREDATA,
12905 #ifdef UA_ENABLE_TYPENAMES
12906  .typeName = "SignatureData",
12907 #endif
12908  .memSize = sizeof(UA_SignatureData),
12909  .builtin = false,
12910  .fixedSize = false,
12911  .overlayable = false,
12912  .binaryEncodingId = 458,
12913  .membersSize = 2,
12914  .members = SignatureData_members },
12915 
12916 /* ReferenceNode */
12917 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 285},
12918  .typeIndex = UA_TYPES_REFERENCENODE,
12919 #ifdef UA_ENABLE_TYPENAMES
12920  .typeName = "ReferenceNode",
12921 #endif
12922  .memSize = sizeof(UA_ReferenceNode),
12923  .builtin = false,
12924  .fixedSize = false,
12925  .overlayable = false,
12926  .binaryEncodingId = 287,
12927  .membersSize = 3,
12928  .members = ReferenceNode_members },
12929 
12930 /* Argument */
12931 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 296},
12932  .typeIndex = UA_TYPES_ARGUMENT,
12933 #ifdef UA_ENABLE_TYPENAMES
12934  .typeName = "Argument",
12935 #endif
12936  .memSize = sizeof(UA_Argument),
12937  .builtin = false,
12938  .fixedSize = false,
12939  .overlayable = false,
12940  .binaryEncodingId = 298,
12941  .membersSize = 5,
12942  .members = Argument_members },
12943 
12944 /* UserIdentityToken */
12945 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 316},
12946  .typeIndex = UA_TYPES_USERIDENTITYTOKEN,
12947 #ifdef UA_ENABLE_TYPENAMES
12948  .typeName = "UserIdentityToken",
12949 #endif
12950  .memSize = sizeof(UA_UserIdentityToken),
12951  .builtin = false,
12952  .fixedSize = false,
12953  .overlayable = false,
12954  .binaryEncodingId = 318,
12955  .membersSize = 1,
12956  .members = UserIdentityToken_members },
12957 
12958 /* ObjectTypeAttributes */
12959 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 361},
12960  .typeIndex = UA_TYPES_OBJECTTYPEATTRIBUTES,
12961 #ifdef UA_ENABLE_TYPENAMES
12962  .typeName = "ObjectTypeAttributes",
12963 #endif
12964  .memSize = sizeof(UA_ObjectTypeAttributes),
12965  .builtin = false,
12966  .fixedSize = false,
12967  .overlayable = false,
12968  .binaryEncodingId = 363,
12969  .membersSize = 6,
12970  .members = ObjectTypeAttributes_members },
12971 
12972 /* DeadbandType */
12973 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12974  .typeIndex = UA_TYPES_INT32,
12975 #ifdef UA_ENABLE_TYPENAMES
12976  .typeName = "DeadbandType",
12977 #endif
12978  .memSize = sizeof(UA_DeadbandType),
12979  .builtin = true,
12980  .fixedSize = true,
12981  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12982  .binaryEncodingId = 0,
12983  .membersSize = 1,
12984  .members = DeadbandType_members },
12985 
12986 /* SecurityTokenRequestType */
12987 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12988  .typeIndex = UA_TYPES_INT32,
12989 #ifdef UA_ENABLE_TYPENAMES
12990  .typeName = "SecurityTokenRequestType",
12991 #endif
12992  .memSize = sizeof(UA_SecurityTokenRequestType),
12993  .builtin = true,
12994  .fixedSize = true,
12995  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12996  .binaryEncodingId = 0,
12997  .membersSize = 1,
12998  .members = SecurityTokenRequestType_members },
12999 
13000 /* DataChangeTrigger */
13001 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13002  .typeIndex = UA_TYPES_INT32,
13003 #ifdef UA_ENABLE_TYPENAMES
13004  .typeName = "DataChangeTrigger",
13005 #endif
13006  .memSize = sizeof(UA_DataChangeTrigger),
13007  .builtin = true,
13008  .fixedSize = true,
13009  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13010  .binaryEncodingId = 0,
13011  .membersSize = 1,
13012  .members = DataChangeTrigger_members },
13013 
13014 /* BuildInfo */
13015 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 338},
13016  .typeIndex = UA_TYPES_BUILDINFO,
13017 #ifdef UA_ENABLE_TYPENAMES
13018  .typeName = "BuildInfo",
13019 #endif
13020  .memSize = sizeof(UA_BuildInfo),
13021  .builtin = false,
13022  .fixedSize = false,
13023  .overlayable = false,
13024  .binaryEncodingId = 340,
13025  .membersSize = 6,
13026  .members = BuildInfo_members },
13027 
13028 /* NodeClass */
13029 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13030  .typeIndex = UA_TYPES_INT32,
13031 #ifdef UA_ENABLE_TYPENAMES
13032  .typeName = "NodeClass",
13033 #endif
13034  .memSize = sizeof(UA_NodeClass),
13035  .builtin = true,
13036  .fixedSize = true,
13037  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13038  .binaryEncodingId = 0,
13039  .membersSize = 1,
13040  .members = NodeClass_members },
13041 
13042 /* ChannelSecurityToken */
13043 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 441},
13044  .typeIndex = UA_TYPES_CHANNELSECURITYTOKEN,
13045 #ifdef UA_ENABLE_TYPENAMES
13046  .typeName = "ChannelSecurityToken",
13047 #endif
13048  .memSize = sizeof(UA_ChannelSecurityToken),
13049  .builtin = false,
13050  .fixedSize = true,
13051  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_ChannelSecurityToken, tokenId) == (offsetof(UA_ChannelSecurityToken, channelId) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_ChannelSecurityToken, createdAt) == (offsetof(UA_ChannelSecurityToken, tokenId) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_ChannelSecurityToken, revisedLifetime) == (offsetof(UA_ChannelSecurityToken, createdAt) + sizeof(UA_DateTime)),
13052  .binaryEncodingId = 443,
13053  .membersSize = 4,
13054  .members = ChannelSecurityToken_members },
13055 
13056 /* MonitoredItemNotification */
13057 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 806},
13059 #ifdef UA_ENABLE_TYPENAMES
13060  .typeName = "MonitoredItemNotification",
13061 #endif
13062  .memSize = sizeof(UA_MonitoredItemNotification),
13063  .builtin = false,
13064  .fixedSize = false,
13065  .overlayable = false,
13066  .binaryEncodingId = 808,
13067  .membersSize = 2,
13068  .members = MonitoredItemNotification_members },
13069 
13070 /* DeleteNodesItem */
13071 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 382},
13072  .typeIndex = UA_TYPES_DELETENODESITEM,
13073 #ifdef UA_ENABLE_TYPENAMES
13074  .typeName = "DeleteNodesItem",
13075 #endif
13076  .memSize = sizeof(UA_DeleteNodesItem),
13077  .builtin = false,
13078  .fixedSize = false,
13079  .overlayable = false,
13080  .binaryEncodingId = 384,
13081  .membersSize = 2,
13082  .members = DeleteNodesItem_members },
13083 
13084 /* SubscriptionAcknowledgement */
13085 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 821},
13087 #ifdef UA_ENABLE_TYPENAMES
13088  .typeName = "SubscriptionAcknowledgement",
13089 #endif
13090  .memSize = sizeof(UA_SubscriptionAcknowledgement),
13091  .builtin = false,
13092  .fixedSize = true,
13093  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_SubscriptionAcknowledgement, sequenceNumber) == (offsetof(UA_SubscriptionAcknowledgement, subscriptionId) + sizeof(UA_UInt32)),
13094  .binaryEncodingId = 823,
13095  .membersSize = 2,
13096  .members = SubscriptionAcknowledgement_members },
13097 
13098 /* ReadValueId */
13099 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 626},
13100  .typeIndex = UA_TYPES_READVALUEID,
13101 #ifdef UA_ENABLE_TYPENAMES
13102  .typeName = "ReadValueId",
13103 #endif
13104  .memSize = sizeof(UA_ReadValueId),
13105  .builtin = false,
13106  .fixedSize = false,
13107  .overlayable = false,
13108  .binaryEncodingId = 628,
13109  .membersSize = 4,
13110  .members = ReadValueId_members },
13111 
13112 /* DataTypeAttributes */
13113 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 370},
13114  .typeIndex = UA_TYPES_DATATYPEATTRIBUTES,
13115 #ifdef UA_ENABLE_TYPENAMES
13116  .typeName = "DataTypeAttributes",
13117 #endif
13118  .memSize = sizeof(UA_DataTypeAttributes),
13119  .builtin = false,
13120  .fixedSize = false,
13121  .overlayable = false,
13122  .binaryEncodingId = 372,
13123  .membersSize = 6,
13124  .members = DataTypeAttributes_members },
13125 
13126 /* ResponseHeader */
13127 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 392},
13128  .typeIndex = UA_TYPES_RESPONSEHEADER,
13129 #ifdef UA_ENABLE_TYPENAMES
13130  .typeName = "ResponseHeader",
13131 #endif
13132  .memSize = sizeof(UA_ResponseHeader),
13133  .builtin = false,
13134  .fixedSize = false,
13135  .overlayable = false,
13136  .binaryEncodingId = 394,
13137  .membersSize = 6,
13138  .members = ResponseHeader_members },
13139 
13140 /* DeleteSubscriptionsRequest */
13141 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 845},
13143 #ifdef UA_ENABLE_TYPENAMES
13144  .typeName = "DeleteSubscriptionsRequest",
13145 #endif
13146  .memSize = sizeof(UA_DeleteSubscriptionsRequest),
13147  .builtin = false,
13148  .fixedSize = false,
13149  .overlayable = false,
13150  .binaryEncodingId = 847,
13151  .membersSize = 2,
13152  .members = DeleteSubscriptionsRequest_members },
13153 
13154 /* ViewDescription */
13155 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 511},
13156  .typeIndex = UA_TYPES_VIEWDESCRIPTION,
13157 #ifdef UA_ENABLE_TYPENAMES
13158  .typeName = "ViewDescription",
13159 #endif
13160  .memSize = sizeof(UA_ViewDescription),
13161  .builtin = false,
13162  .fixedSize = false,
13163  .overlayable = false,
13164  .binaryEncodingId = 513,
13165  .membersSize = 3,
13166  .members = ViewDescription_members },
13167 
13168 /* DeleteMonitoredItemsResponse */
13169 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 782},
13171 #ifdef UA_ENABLE_TYPENAMES
13172  .typeName = "DeleteMonitoredItemsResponse",
13173 #endif
13174  .memSize = sizeof(UA_DeleteMonitoredItemsResponse),
13175  .builtin = false,
13176  .fixedSize = false,
13177  .overlayable = false,
13178  .binaryEncodingId = 784,
13179  .membersSize = 3,
13180  .members = DeleteMonitoredItemsResponse_members },
13181 
13182 /* NodeAttributes */
13183 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 349},
13184  .typeIndex = UA_TYPES_NODEATTRIBUTES,
13185 #ifdef UA_ENABLE_TYPENAMES
13186  .typeName = "NodeAttributes",
13187 #endif
13188  .memSize = sizeof(UA_NodeAttributes),
13189  .builtin = false,
13190  .fixedSize = false,
13191  .overlayable = false,
13192  .binaryEncodingId = 351,
13193  .membersSize = 5,
13194  .members = NodeAttributes_members },
13195 
13196 /* RegisterNodesRequest */
13197 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 558},
13198  .typeIndex = UA_TYPES_REGISTERNODESREQUEST,
13199 #ifdef UA_ENABLE_TYPENAMES
13200  .typeName = "RegisterNodesRequest",
13201 #endif
13202  .memSize = sizeof(UA_RegisterNodesRequest),
13203  .builtin = false,
13204  .fixedSize = false,
13205  .overlayable = false,
13206  .binaryEncodingId = 560,
13207  .membersSize = 2,
13208  .members = RegisterNodesRequest_members },
13209 
13210 /* DeleteNodesRequest */
13211 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 498},
13212  .typeIndex = UA_TYPES_DELETENODESREQUEST,
13213 #ifdef UA_ENABLE_TYPENAMES
13214  .typeName = "DeleteNodesRequest",
13215 #endif
13216  .memSize = sizeof(UA_DeleteNodesRequest),
13217  .builtin = false,
13218  .fixedSize = false,
13219  .overlayable = false,
13220  .binaryEncodingId = 500,
13221  .membersSize = 2,
13222  .members = DeleteNodesRequest_members },
13223 
13224 /* PublishResponse */
13225 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 827},
13226  .typeIndex = UA_TYPES_PUBLISHRESPONSE,
13227 #ifdef UA_ENABLE_TYPENAMES
13228  .typeName = "PublishResponse",
13229 #endif
13230  .memSize = sizeof(UA_PublishResponse),
13231  .builtin = false,
13232  .fixedSize = false,
13233  .overlayable = false,
13234  .binaryEncodingId = 829,
13235  .membersSize = 7,
13236  .members = PublishResponse_members },
13237 
13238 /* MonitoredItemModifyRequest */
13239 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 755},
13241 #ifdef UA_ENABLE_TYPENAMES
13242  .typeName = "MonitoredItemModifyRequest",
13243 #endif
13244  .memSize = sizeof(UA_MonitoredItemModifyRequest),
13245  .builtin = false,
13246  .fixedSize = false,
13247  .overlayable = false,
13248  .binaryEncodingId = 757,
13249  .membersSize = 2,
13250  .members = MonitoredItemModifyRequest_members },
13251 
13252 /* UserNameIdentityToken */
13253 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 322},
13254  .typeIndex = UA_TYPES_USERNAMEIDENTITYTOKEN,
13255 #ifdef UA_ENABLE_TYPENAMES
13256  .typeName = "UserNameIdentityToken",
13257 #endif
13258  .memSize = sizeof(UA_UserNameIdentityToken),
13259  .builtin = false,
13260  .fixedSize = false,
13261  .overlayable = false,
13262  .binaryEncodingId = 324,
13263  .membersSize = 4,
13264  .members = UserNameIdentityToken_members },
13265 
13266 /* IdType */
13267 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13268  .typeIndex = UA_TYPES_INT32,
13269 #ifdef UA_ENABLE_TYPENAMES
13270  .typeName = "IdType",
13271 #endif
13272  .memSize = sizeof(UA_IdType),
13273  .builtin = true,
13274  .fixedSize = true,
13275  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13276  .binaryEncodingId = 0,
13277  .membersSize = 1,
13278  .members = IdType_members },
13279 
13280 /* UserTokenType */
13281 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13282  .typeIndex = UA_TYPES_INT32,
13283 #ifdef UA_ENABLE_TYPENAMES
13284  .typeName = "UserTokenType",
13285 #endif
13286  .memSize = sizeof(UA_UserTokenType),
13287  .builtin = true,
13288  .fixedSize = true,
13289  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13290  .binaryEncodingId = 0,
13291  .membersSize = 1,
13292  .members = UserTokenType_members },
13293 
13294 /* ActivateSessionRequest */
13295 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 465},
13296  .typeIndex = UA_TYPES_ACTIVATESESSIONREQUEST,
13297 #ifdef UA_ENABLE_TYPENAMES
13298  .typeName = "ActivateSessionRequest",
13299 #endif
13300  .memSize = sizeof(UA_ActivateSessionRequest),
13301  .builtin = false,
13302  .fixedSize = false,
13303  .overlayable = false,
13304  .binaryEncodingId = 467,
13305  .membersSize = 6,
13306  .members = ActivateSessionRequest_members },
13307 
13308 /* OpenSecureChannelResponse */
13309 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 447},
13311 #ifdef UA_ENABLE_TYPENAMES
13312  .typeName = "OpenSecureChannelResponse",
13313 #endif
13314  .memSize = sizeof(UA_OpenSecureChannelResponse),
13315  .builtin = false,
13316  .fixedSize = false,
13317  .overlayable = false,
13318  .binaryEncodingId = 449,
13319  .membersSize = 4,
13320  .members = OpenSecureChannelResponse_members },
13321 
13322 /* ApplicationType */
13323 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13324  .typeIndex = UA_TYPES_INT32,
13325 #ifdef UA_ENABLE_TYPENAMES
13326  .typeName = "ApplicationType",
13327 #endif
13328  .memSize = sizeof(UA_ApplicationType),
13329  .builtin = true,
13330  .fixedSize = true,
13331  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13332  .binaryEncodingId = 0,
13333  .membersSize = 1,
13334  .members = ApplicationType_members },
13335 
13336 /* ServerState */
13337 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13338  .typeIndex = UA_TYPES_INT32,
13339 #ifdef UA_ENABLE_TYPENAMES
13340  .typeName = "ServerState",
13341 #endif
13342  .memSize = sizeof(UA_ServerState),
13343  .builtin = true,
13344  .fixedSize = true,
13345  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13346  .binaryEncodingId = 0,
13347  .membersSize = 1,
13348  .members = ServerState_members },
13349 
13350 /* QueryNextResponse */
13351 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 622},
13352  .typeIndex = UA_TYPES_QUERYNEXTRESPONSE,
13353 #ifdef UA_ENABLE_TYPENAMES
13354  .typeName = "QueryNextResponse",
13355 #endif
13356  .memSize = sizeof(UA_QueryNextResponse),
13357  .builtin = false,
13358  .fixedSize = false,
13359  .overlayable = false,
13360  .binaryEncodingId = 624,
13361  .membersSize = 3,
13362  .members = QueryNextResponse_members },
13363 
13364 /* ActivateSessionResponse */
13365 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 468},
13366  .typeIndex = UA_TYPES_ACTIVATESESSIONRESPONSE,
13367 #ifdef UA_ENABLE_TYPENAMES
13368  .typeName = "ActivateSessionResponse",
13369 #endif
13370  .memSize = sizeof(UA_ActivateSessionResponse),
13371  .builtin = false,
13372  .fixedSize = false,
13373  .overlayable = false,
13374  .binaryEncodingId = 470,
13375  .membersSize = 4,
13376  .members = ActivateSessionResponse_members },
13377 
13378 /* FilterOperator */
13379 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13380  .typeIndex = UA_TYPES_INT32,
13381 #ifdef UA_ENABLE_TYPENAMES
13382  .typeName = "FilterOperator",
13383 #endif
13384  .memSize = sizeof(UA_FilterOperator),
13385  .builtin = true,
13386  .fixedSize = true,
13387  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13388  .binaryEncodingId = 0,
13389  .membersSize = 1,
13390  .members = FilterOperator_members },
13391 
13392 /* QueryNextRequest */
13393 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 619},
13394  .typeIndex = UA_TYPES_QUERYNEXTREQUEST,
13395 #ifdef UA_ENABLE_TYPENAMES
13396  .typeName = "QueryNextRequest",
13397 #endif
13398  .memSize = sizeof(UA_QueryNextRequest),
13399  .builtin = false,
13400  .fixedSize = false,
13401  .overlayable = false,
13402  .binaryEncodingId = 621,
13403  .membersSize = 3,
13404  .members = QueryNextRequest_members },
13405 
13406 /* WriteResponse */
13407 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 674},
13408  .typeIndex = UA_TYPES_WRITERESPONSE,
13409 #ifdef UA_ENABLE_TYPENAMES
13410  .typeName = "WriteResponse",
13411 #endif
13412  .memSize = sizeof(UA_WriteResponse),
13413  .builtin = false,
13414  .fixedSize = false,
13415  .overlayable = false,
13416  .binaryEncodingId = 676,
13417  .membersSize = 3,
13418  .members = WriteResponse_members },
13419 
13420 /* BrowseNextRequest */
13421 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 531},
13422  .typeIndex = UA_TYPES_BROWSENEXTREQUEST,
13423 #ifdef UA_ENABLE_TYPENAMES
13424  .typeName = "BrowseNextRequest",
13425 #endif
13426  .memSize = sizeof(UA_BrowseNextRequest),
13427  .builtin = false,
13428  .fixedSize = false,
13429  .overlayable = false,
13430  .binaryEncodingId = 533,
13431  .membersSize = 3,
13432  .members = BrowseNextRequest_members },
13433 
13434 /* CreateSubscriptionRequest */
13435 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 785},
13437 #ifdef UA_ENABLE_TYPENAMES
13438  .typeName = "CreateSubscriptionRequest",
13439 #endif
13440  .memSize = sizeof(UA_CreateSubscriptionRequest),
13441  .builtin = false,
13442  .fixedSize = false,
13443  .overlayable = false,
13444  .binaryEncodingId = 787,
13445  .membersSize = 7,
13446  .members = CreateSubscriptionRequest_members },
13447 
13448 /* VariableTypeAttributes */
13449 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 364},
13450  .typeIndex = UA_TYPES_VARIABLETYPEATTRIBUTES,
13451 #ifdef UA_ENABLE_TYPENAMES
13452  .typeName = "VariableTypeAttributes",
13453 #endif
13454  .memSize = sizeof(UA_VariableTypeAttributes),
13455  .builtin = false,
13456  .fixedSize = false,
13457  .overlayable = false,
13458  .binaryEncodingId = 366,
13459  .membersSize = 10,
13460  .members = VariableTypeAttributes_members },
13461 
13462 /* BrowsePathResult */
13463 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 549},
13464  .typeIndex = UA_TYPES_BROWSEPATHRESULT,
13465 #ifdef UA_ENABLE_TYPENAMES
13466  .typeName = "BrowsePathResult",
13467 #endif
13468  .memSize = sizeof(UA_BrowsePathResult),
13469  .builtin = false,
13470  .fixedSize = false,
13471  .overlayable = false,
13472  .binaryEncodingId = 551,
13473  .membersSize = 2,
13474  .members = BrowsePathResult_members },
13475 
13476 /* ModifySubscriptionResponse */
13477 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 794},
13479 #ifdef UA_ENABLE_TYPENAMES
13480  .typeName = "ModifySubscriptionResponse",
13481 #endif
13482  .memSize = sizeof(UA_ModifySubscriptionResponse),
13483  .builtin = false,
13484  .fixedSize = false,
13485  .overlayable = false,
13486  .binaryEncodingId = 796,
13487  .membersSize = 4,
13488  .members = ModifySubscriptionResponse_members },
13489 
13490 /* OpenSecureChannelRequest */
13491 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 444},
13492  .typeIndex = UA_TYPES_OPENSECURECHANNELREQUEST,
13493 #ifdef UA_ENABLE_TYPENAMES
13494  .typeName = "OpenSecureChannelRequest",
13495 #endif
13496  .memSize = sizeof(UA_OpenSecureChannelRequest),
13497  .builtin = false,
13498  .fixedSize = false,
13499  .overlayable = false,
13500  .binaryEncodingId = 446,
13501  .membersSize = 6,
13502  .members = OpenSecureChannelRequest_members },
13503 
13504 /* RegisterNodesResponse */
13505 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 561},
13506  .typeIndex = UA_TYPES_REGISTERNODESRESPONSE,
13507 #ifdef UA_ENABLE_TYPENAMES
13508  .typeName = "RegisterNodesResponse",
13509 #endif
13510  .memSize = sizeof(UA_RegisterNodesResponse),
13511  .builtin = false,
13512  .fixedSize = false,
13513  .overlayable = false,
13514  .binaryEncodingId = 563,
13515  .membersSize = 2,
13516  .members = RegisterNodesResponse_members },
13517 
13518 /* CloseSessionRequest */
13519 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 471},
13520  .typeIndex = UA_TYPES_CLOSESESSIONREQUEST,
13521 #ifdef UA_ENABLE_TYPENAMES
13522  .typeName = "CloseSessionRequest",
13523 #endif
13524  .memSize = sizeof(UA_CloseSessionRequest),
13525  .builtin = false,
13526  .fixedSize = false,
13527  .overlayable = false,
13528  .binaryEncodingId = 473,
13529  .membersSize = 2,
13530  .members = CloseSessionRequest_members },
13531 
13532 /* ModifySubscriptionRequest */
13533 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 791},
13535 #ifdef UA_ENABLE_TYPENAMES
13536  .typeName = "ModifySubscriptionRequest",
13537 #endif
13538  .memSize = sizeof(UA_ModifySubscriptionRequest),
13539  .builtin = false,
13540  .fixedSize = false,
13541  .overlayable = false,
13542  .binaryEncodingId = 793,
13543  .membersSize = 7,
13544  .members = ModifySubscriptionRequest_members },
13545 
13546 /* UserTokenPolicy */
13547 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 304},
13548  .typeIndex = UA_TYPES_USERTOKENPOLICY,
13549 #ifdef UA_ENABLE_TYPENAMES
13550  .typeName = "UserTokenPolicy",
13551 #endif
13552  .memSize = sizeof(UA_UserTokenPolicy),
13553  .builtin = false,
13554  .fixedSize = false,
13555  .overlayable = false,
13556  .binaryEncodingId = 306,
13557  .membersSize = 5,
13558  .members = UserTokenPolicy_members },
13559 
13560 /* DeleteMonitoredItemsRequest */
13561 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 779},
13563 #ifdef UA_ENABLE_TYPENAMES
13564  .typeName = "DeleteMonitoredItemsRequest",
13565 #endif
13566  .memSize = sizeof(UA_DeleteMonitoredItemsRequest),
13567  .builtin = false,
13568  .fixedSize = false,
13569  .overlayable = false,
13570  .binaryEncodingId = 781,
13571  .membersSize = 3,
13572  .members = DeleteMonitoredItemsRequest_members },
13573 
13574 /* ReferenceTypeAttributes */
13575 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 367},
13576  .typeIndex = UA_TYPES_REFERENCETYPEATTRIBUTES,
13577 #ifdef UA_ENABLE_TYPENAMES
13578  .typeName = "ReferenceTypeAttributes",
13579 #endif
13580  .memSize = sizeof(UA_ReferenceTypeAttributes),
13581  .builtin = false,
13582  .fixedSize = false,
13583  .overlayable = false,
13584  .binaryEncodingId = 369,
13585  .membersSize = 8,
13586  .members = ReferenceTypeAttributes_members },
13587 
13588 /* SetMonitoringModeRequest */
13589 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 767},
13590  .typeIndex = UA_TYPES_SETMONITORINGMODEREQUEST,
13591 #ifdef UA_ENABLE_TYPENAMES
13592  .typeName = "SetMonitoringModeRequest",
13593 #endif
13594  .memSize = sizeof(UA_SetMonitoringModeRequest),
13595  .builtin = false,
13596  .fixedSize = false,
13597  .overlayable = false,
13598  .binaryEncodingId = 769,
13599  .membersSize = 4,
13600  .members = SetMonitoringModeRequest_members },
13601 
13602 /* UnregisterNodesResponse */
13603 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 567},
13604  .typeIndex = UA_TYPES_UNREGISTERNODESRESPONSE,
13605 #ifdef UA_ENABLE_TYPENAMES
13606  .typeName = "UnregisterNodesResponse",
13607 #endif
13608  .memSize = sizeof(UA_UnregisterNodesResponse),
13609  .builtin = false,
13610  .fixedSize = false,
13611  .overlayable = false,
13612  .binaryEncodingId = 569,
13613  .membersSize = 1,
13614  .members = UnregisterNodesResponse_members },
13615 
13616 /* WriteRequest */
13617 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 671},
13618  .typeIndex = UA_TYPES_WRITEREQUEST,
13619 #ifdef UA_ENABLE_TYPENAMES
13620  .typeName = "WriteRequest",
13621 #endif
13622  .memSize = sizeof(UA_WriteRequest),
13623  .builtin = false,
13624  .fixedSize = false,
13625  .overlayable = false,
13626  .binaryEncodingId = 673,
13627  .membersSize = 2,
13628  .members = WriteRequest_members },
13629 
13630 /* ObjectAttributes */
13631 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 352},
13632  .typeIndex = UA_TYPES_OBJECTATTRIBUTES,
13633 #ifdef UA_ENABLE_TYPENAMES
13634  .typeName = "ObjectAttributes",
13635 #endif
13636  .memSize = sizeof(UA_ObjectAttributes),
13637  .builtin = false,
13638  .fixedSize = false,
13639  .overlayable = false,
13640  .binaryEncodingId = 354,
13641  .membersSize = 6,
13642  .members = ObjectAttributes_members },
13643 
13644 /* BrowseDescription */
13645 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 514},
13646  .typeIndex = UA_TYPES_BROWSEDESCRIPTION,
13647 #ifdef UA_ENABLE_TYPENAMES
13648  .typeName = "BrowseDescription",
13649 #endif
13650  .memSize = sizeof(UA_BrowseDescription),
13651  .builtin = false,
13652  .fixedSize = false,
13653  .overlayable = false,
13654  .binaryEncodingId = 516,
13655  .membersSize = 6,
13656  .members = BrowseDescription_members },
13657 
13658 /* RepublishRequest */
13659 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 830},
13660  .typeIndex = UA_TYPES_REPUBLISHREQUEST,
13661 #ifdef UA_ENABLE_TYPENAMES
13662  .typeName = "RepublishRequest",
13663 #endif
13664  .memSize = sizeof(UA_RepublishRequest),
13665  .builtin = false,
13666  .fixedSize = false,
13667  .overlayable = false,
13668  .binaryEncodingId = 832,
13669  .membersSize = 3,
13670  .members = RepublishRequest_members },
13671 
13672 /* GetEndpointsRequest */
13673 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 426},
13674  .typeIndex = UA_TYPES_GETENDPOINTSREQUEST,
13675 #ifdef UA_ENABLE_TYPENAMES
13676  .typeName = "GetEndpointsRequest",
13677 #endif
13678  .memSize = sizeof(UA_GetEndpointsRequest),
13679  .builtin = false,
13680  .fixedSize = false,
13681  .overlayable = false,
13682  .binaryEncodingId = 428,
13683  .membersSize = 4,
13684  .members = GetEndpointsRequest_members },
13685 
13686 /* PublishRequest */
13687 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 824},
13688  .typeIndex = UA_TYPES_PUBLISHREQUEST,
13689 #ifdef UA_ENABLE_TYPENAMES
13690  .typeName = "PublishRequest",
13691 #endif
13692  .memSize = sizeof(UA_PublishRequest),
13693  .builtin = false,
13694  .fixedSize = false,
13695  .overlayable = false,
13696  .binaryEncodingId = 826,
13697  .membersSize = 2,
13698  .members = PublishRequest_members },
13699 
13700 /* AddNodesResponse */
13701 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 489},
13702  .typeIndex = UA_TYPES_ADDNODESRESPONSE,
13703 #ifdef UA_ENABLE_TYPENAMES
13704  .typeName = "AddNodesResponse",
13705 #endif
13706  .memSize = sizeof(UA_AddNodesResponse),
13707  .builtin = false,
13708  .fixedSize = false,
13709  .overlayable = false,
13710  .binaryEncodingId = 491,
13711  .membersSize = 3,
13712  .members = AddNodesResponse_members },
13713 
13714 /* DataChangeNotification */
13715 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 809},
13716  .typeIndex = UA_TYPES_DATACHANGENOTIFICATION,
13717 #ifdef UA_ENABLE_TYPENAMES
13718  .typeName = "DataChangeNotification",
13719 #endif
13720  .memSize = sizeof(UA_DataChangeNotification),
13721  .builtin = false,
13722  .fixedSize = false,
13723  .overlayable = false,
13724  .binaryEncodingId = 811,
13725  .membersSize = 2,
13726  .members = DataChangeNotification_members },
13727 
13728 /* CloseSecureChannelResponse */
13729 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 453},
13731 #ifdef UA_ENABLE_TYPENAMES
13732  .typeName = "CloseSecureChannelResponse",
13733 #endif
13734  .memSize = sizeof(UA_CloseSecureChannelResponse),
13735  .builtin = false,
13736  .fixedSize = false,
13737  .overlayable = false,
13738  .binaryEncodingId = 455,
13739  .membersSize = 1,
13740  .members = CloseSecureChannelResponse_members },
13741 
13742 /* ModifyMonitoredItemsRequest */
13743 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 761},
13745 #ifdef UA_ENABLE_TYPENAMES
13746  .typeName = "ModifyMonitoredItemsRequest",
13747 #endif
13748  .memSize = sizeof(UA_ModifyMonitoredItemsRequest),
13749  .builtin = false,
13750  .fixedSize = false,
13751  .overlayable = false,
13752  .binaryEncodingId = 763,
13753  .membersSize = 4,
13754  .members = ModifyMonitoredItemsRequest_members },
13755 
13756 /* SetMonitoringModeResponse */
13757 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 770},
13759 #ifdef UA_ENABLE_TYPENAMES
13760  .typeName = "SetMonitoringModeResponse",
13761 #endif
13762  .memSize = sizeof(UA_SetMonitoringModeResponse),
13763  .builtin = false,
13764  .fixedSize = false,
13765  .overlayable = false,
13766  .binaryEncodingId = 772,
13767  .membersSize = 3,
13768  .members = SetMonitoringModeResponse_members },
13769 
13770 /* FindServersRequest */
13771 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 420},
13772  .typeIndex = UA_TYPES_FINDSERVERSREQUEST,
13773 #ifdef UA_ENABLE_TYPENAMES
13774  .typeName = "FindServersRequest",
13775 #endif
13776  .memSize = sizeof(UA_FindServersRequest),
13777  .builtin = false,
13778  .fixedSize = false,
13779  .overlayable = false,
13780  .binaryEncodingId = 422,
13781  .membersSize = 4,
13782  .members = FindServersRequest_members },
13783 
13784 /* ReferenceDescription */
13785 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 518},
13786  .typeIndex = UA_TYPES_REFERENCEDESCRIPTION,
13787 #ifdef UA_ENABLE_TYPENAMES
13788  .typeName = "ReferenceDescription",
13789 #endif
13790  .memSize = sizeof(UA_ReferenceDescription),
13791  .builtin = false,
13792  .fixedSize = false,
13793  .overlayable = false,
13794  .binaryEncodingId = 520,
13795  .membersSize = 7,
13796  .members = ReferenceDescription_members },
13797 
13798 /* SetPublishingModeResponse */
13799 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 800},
13801 #ifdef UA_ENABLE_TYPENAMES
13802  .typeName = "SetPublishingModeResponse",
13803 #endif
13804  .memSize = sizeof(UA_SetPublishingModeResponse),
13805  .builtin = false,
13806  .fixedSize = false,
13807  .overlayable = false,
13808  .binaryEncodingId = 802,
13809  .membersSize = 3,
13810  .members = SetPublishingModeResponse_members },
13811 
13812 /* ContentFilterResult */
13813 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 607},
13814  .typeIndex = UA_TYPES_CONTENTFILTERRESULT,
13815 #ifdef UA_ENABLE_TYPENAMES
13816  .typeName = "ContentFilterResult",
13817 #endif
13818  .memSize = sizeof(UA_ContentFilterResult),
13819  .builtin = false,
13820  .fixedSize = false,
13821  .overlayable = false,
13822  .binaryEncodingId = 609,
13823  .membersSize = 2,
13824  .members = ContentFilterResult_members },
13825 
13826 /* AddReferencesItem */
13827 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 379},
13828  .typeIndex = UA_TYPES_ADDREFERENCESITEM,
13829 #ifdef UA_ENABLE_TYPENAMES
13830  .typeName = "AddReferencesItem",
13831 #endif
13832  .memSize = sizeof(UA_AddReferencesItem),
13833  .builtin = false,
13834  .fixedSize = false,
13835  .overlayable = false,
13836  .binaryEncodingId = 381,
13837  .membersSize = 6,
13838  .members = AddReferencesItem_members },
13839 
13840 /* CreateSubscriptionResponse */
13841 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 788},
13843 #ifdef UA_ENABLE_TYPENAMES
13844  .typeName = "CreateSubscriptionResponse",
13845 #endif
13846  .memSize = sizeof(UA_CreateSubscriptionResponse),
13847  .builtin = false,
13848  .fixedSize = false,
13849  .overlayable = false,
13850  .binaryEncodingId = 790,
13851  .membersSize = 5,
13852  .members = CreateSubscriptionResponse_members },
13853 
13854 /* DeleteSubscriptionsResponse */
13855 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 848},
13857 #ifdef UA_ENABLE_TYPENAMES
13858  .typeName = "DeleteSubscriptionsResponse",
13859 #endif
13860  .memSize = sizeof(UA_DeleteSubscriptionsResponse),
13861  .builtin = false,
13862  .fixedSize = false,
13863  .overlayable = false,
13864  .binaryEncodingId = 850,
13865  .membersSize = 3,
13866  .members = DeleteSubscriptionsResponse_members },
13867 
13868 /* RelativePath */
13869 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 540},
13870  .typeIndex = UA_TYPES_RELATIVEPATH,
13871 #ifdef UA_ENABLE_TYPENAMES
13872  .typeName = "RelativePath",
13873 #endif
13874  .memSize = sizeof(UA_RelativePath),
13875  .builtin = false,
13876  .fixedSize = false,
13877  .overlayable = false,
13878  .binaryEncodingId = 542,
13879  .membersSize = 1,
13880  .members = RelativePath_members },
13881 
13882 /* DeleteReferencesResponse */
13883 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 507},
13884  .typeIndex = UA_TYPES_DELETEREFERENCESRESPONSE,
13885 #ifdef UA_ENABLE_TYPENAMES
13886  .typeName = "DeleteReferencesResponse",
13887 #endif
13888  .memSize = sizeof(UA_DeleteReferencesResponse),
13889  .builtin = false,
13890  .fixedSize = false,
13891  .overlayable = false,
13892  .binaryEncodingId = 509,
13893  .membersSize = 3,
13894  .members = DeleteReferencesResponse_members },
13895 
13896 /* CreateMonitoredItemsResponse */
13897 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 752},
13899 #ifdef UA_ENABLE_TYPENAMES
13900  .typeName = "CreateMonitoredItemsResponse",
13901 #endif
13902  .memSize = sizeof(UA_CreateMonitoredItemsResponse),
13903  .builtin = false,
13904  .fixedSize = false,
13905  .overlayable = false,
13906  .binaryEncodingId = 754,
13907  .membersSize = 3,
13908  .members = CreateMonitoredItemsResponse_members },
13909 
13910 /* CallResponse */
13911 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 713},
13912  .typeIndex = UA_TYPES_CALLRESPONSE,
13913 #ifdef UA_ENABLE_TYPENAMES
13914  .typeName = "CallResponse",
13915 #endif
13916  .memSize = sizeof(UA_CallResponse),
13917  .builtin = false,
13918  .fixedSize = false,
13919  .overlayable = false,
13920  .binaryEncodingId = 715,
13921  .membersSize = 3,
13922  .members = CallResponse_members },
13923 
13924 /* DeleteNodesResponse */
13925 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 501},
13926  .typeIndex = UA_TYPES_DELETENODESRESPONSE,
13927 #ifdef UA_ENABLE_TYPENAMES
13928  .typeName = "DeleteNodesResponse",
13929 #endif
13930  .memSize = sizeof(UA_DeleteNodesResponse),
13931  .builtin = false,
13932  .fixedSize = false,
13933  .overlayable = false,
13934  .binaryEncodingId = 503,
13935  .membersSize = 3,
13936  .members = DeleteNodesResponse_members },
13937 
13938 /* RepublishResponse */
13939 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 833},
13940  .typeIndex = UA_TYPES_REPUBLISHRESPONSE,
13941 #ifdef UA_ENABLE_TYPENAMES
13942  .typeName = "RepublishResponse",
13943 #endif
13944  .memSize = sizeof(UA_RepublishResponse),
13945  .builtin = false,
13946  .fixedSize = false,
13947  .overlayable = false,
13948  .binaryEncodingId = 835,
13949  .membersSize = 2,
13950  .members = RepublishResponse_members },
13951 
13952 /* MonitoredItemCreateRequest */
13953 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 743},
13955 #ifdef UA_ENABLE_TYPENAMES
13956  .typeName = "MonitoredItemCreateRequest",
13957 #endif
13958  .memSize = sizeof(UA_MonitoredItemCreateRequest),
13959  .builtin = false,
13960  .fixedSize = false,
13961  .overlayable = false,
13962  .binaryEncodingId = 745,
13963  .membersSize = 3,
13964  .members = MonitoredItemCreateRequest_members },
13965 
13966 /* DeleteReferencesRequest */
13967 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 504},
13968  .typeIndex = UA_TYPES_DELETEREFERENCESREQUEST,
13969 #ifdef UA_ENABLE_TYPENAMES
13970  .typeName = "DeleteReferencesRequest",
13971 #endif
13972  .memSize = sizeof(UA_DeleteReferencesRequest),
13973  .builtin = false,
13974  .fixedSize = false,
13975  .overlayable = false,
13976  .binaryEncodingId = 506,
13977  .membersSize = 2,
13978  .members = DeleteReferencesRequest_members },
13979 
13980 /* ModifyMonitoredItemsResponse */
13981 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 764},
13983 #ifdef UA_ENABLE_TYPENAMES
13984  .typeName = "ModifyMonitoredItemsResponse",
13985 #endif
13986  .memSize = sizeof(UA_ModifyMonitoredItemsResponse),
13987  .builtin = false,
13988  .fixedSize = false,
13989  .overlayable = false,
13990  .binaryEncodingId = 766,
13991  .membersSize = 3,
13992  .members = ModifyMonitoredItemsResponse_members },
13993 
13994 /* ReadResponse */
13995 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 632},
13996  .typeIndex = UA_TYPES_READRESPONSE,
13997 #ifdef UA_ENABLE_TYPENAMES
13998  .typeName = "ReadResponse",
13999 #endif
14000  .memSize = sizeof(UA_ReadResponse),
14001  .builtin = false,
14002  .fixedSize = false,
14003  .overlayable = false,
14004  .binaryEncodingId = 634,
14005  .membersSize = 3,
14006  .members = ReadResponse_members },
14007 
14008 /* AddReferencesRequest */
14009 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 492},
14010  .typeIndex = UA_TYPES_ADDREFERENCESREQUEST,
14011 #ifdef UA_ENABLE_TYPENAMES
14012  .typeName = "AddReferencesRequest",
14013 #endif
14014  .memSize = sizeof(UA_AddReferencesRequest),
14015  .builtin = false,
14016  .fixedSize = false,
14017  .overlayable = false,
14018  .binaryEncodingId = 494,
14019  .membersSize = 2,
14020  .members = AddReferencesRequest_members },
14021 
14022 /* ReadRequest */
14023 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 629},
14024  .typeIndex = UA_TYPES_READREQUEST,
14025 #ifdef UA_ENABLE_TYPENAMES
14026  .typeName = "ReadRequest",
14027 #endif
14028  .memSize = sizeof(UA_ReadRequest),
14029  .builtin = false,
14030  .fixedSize = false,
14031  .overlayable = false,
14032  .binaryEncodingId = 631,
14033  .membersSize = 4,
14034  .members = ReadRequest_members },
14035 
14036 /* AddNodesItem */
14037 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 376},
14038  .typeIndex = UA_TYPES_ADDNODESITEM,
14039 #ifdef UA_ENABLE_TYPENAMES
14040  .typeName = "AddNodesItem",
14041 #endif
14042  .memSize = sizeof(UA_AddNodesItem),
14043  .builtin = false,
14044  .fixedSize = false,
14045  .overlayable = false,
14046  .binaryEncodingId = 378,
14047  .membersSize = 7,
14048  .members = AddNodesItem_members },
14049 
14050 /* ServerStatusDataType */
14051 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 862},
14052  .typeIndex = UA_TYPES_SERVERSTATUSDATATYPE,
14053 #ifdef UA_ENABLE_TYPENAMES
14054  .typeName = "ServerStatusDataType",
14055 #endif
14056  .memSize = sizeof(UA_ServerStatusDataType),
14057  .builtin = false,
14058  .fixedSize = false,
14059  .overlayable = false,
14060  .binaryEncodingId = 864,
14061  .membersSize = 6,
14062  .members = ServerStatusDataType_members },
14063 
14064 /* AddReferencesResponse */
14065 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 495},
14066  .typeIndex = UA_TYPES_ADDREFERENCESRESPONSE,
14067 #ifdef UA_ENABLE_TYPENAMES
14068  .typeName = "AddReferencesResponse",
14069 #endif
14070  .memSize = sizeof(UA_AddReferencesResponse),
14071  .builtin = false,
14072  .fixedSize = false,
14073  .overlayable = false,
14074  .binaryEncodingId = 497,
14075  .membersSize = 3,
14076  .members = AddReferencesResponse_members },
14077 
14078 /* TranslateBrowsePathsToNodeIdsResponse */
14079 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 555},
14081 #ifdef UA_ENABLE_TYPENAMES
14082  .typeName = "TranslateBrowsePathsToNodeIdsResponse",
14083 #endif
14084  .memSize = sizeof(UA_TranslateBrowsePathsToNodeIdsResponse),
14085  .builtin = false,
14086  .fixedSize = false,
14087  .overlayable = false,
14088  .binaryEncodingId = 557,
14089  .membersSize = 3,
14090  .members = TranslateBrowsePathsToNodeIdsResponse_members },
14091 
14092 /* DataChangeFilter */
14093 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 722},
14094  .typeIndex = UA_TYPES_DATACHANGEFILTER,
14095 #ifdef UA_ENABLE_TYPENAMES
14096  .typeName = "DataChangeFilter",
14097 #endif
14098  .memSize = sizeof(UA_DataChangeFilter),
14099  .builtin = false,
14100  .fixedSize = true,
14101  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_DataChangeFilter, deadbandType) == (offsetof(UA_DataChangeFilter, trigger) + sizeof(UA_DataChangeTrigger)) && UA_BINARY_OVERLAYABLE_FLOAT && offsetof(UA_DataChangeFilter, deadbandValue) == (offsetof(UA_DataChangeFilter, deadbandType) + sizeof(UA_UInt32)),
14102  .binaryEncodingId = 724,
14103  .membersSize = 3,
14104  .members = DataChangeFilter_members },
14105 
14106 /* ContentFilterElement */
14107 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 583},
14108  .typeIndex = UA_TYPES_CONTENTFILTERELEMENT,
14109 #ifdef UA_ENABLE_TYPENAMES
14110  .typeName = "ContentFilterElement",
14111 #endif
14112  .memSize = sizeof(UA_ContentFilterElement),
14113  .builtin = false,
14114  .fixedSize = false,
14115  .overlayable = false,
14116  .binaryEncodingId = 585,
14117  .membersSize = 2,
14118  .members = ContentFilterElement_members },
14119 
14120 /* CloseSessionResponse */
14121 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 474},
14122  .typeIndex = UA_TYPES_CLOSESESSIONRESPONSE,
14123 #ifdef UA_ENABLE_TYPENAMES
14124  .typeName = "CloseSessionResponse",
14125 #endif
14126  .memSize = sizeof(UA_CloseSessionResponse),
14127  .builtin = false,
14128  .fixedSize = false,
14129  .overlayable = false,
14130  .binaryEncodingId = 476,
14131  .membersSize = 1,
14132  .members = CloseSessionResponse_members },
14133 
14134 /* ApplicationDescription */
14135 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 308},
14136  .typeIndex = UA_TYPES_APPLICATIONDESCRIPTION,
14137 #ifdef UA_ENABLE_TYPENAMES
14138  .typeName = "ApplicationDescription",
14139 #endif
14140  .memSize = sizeof(UA_ApplicationDescription),
14141  .builtin = false,
14142  .fixedSize = false,
14143  .overlayable = false,
14144  .binaryEncodingId = 310,
14145  .membersSize = 7,
14146  .members = ApplicationDescription_members },
14147 
14148 /* ServiceFault */
14149 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 395},
14150  .typeIndex = UA_TYPES_SERVICEFAULT,
14151 #ifdef UA_ENABLE_TYPENAMES
14152  .typeName = "ServiceFault",
14153 #endif
14154  .memSize = sizeof(UA_ServiceFault),
14155  .builtin = false,
14156  .fixedSize = false,
14157  .overlayable = false,
14158  .binaryEncodingId = 397,
14159  .membersSize = 1,
14160  .members = ServiceFault_members },
14161 
14162 /* FindServersResponse */
14163 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 423},
14164  .typeIndex = UA_TYPES_FINDSERVERSRESPONSE,
14165 #ifdef UA_ENABLE_TYPENAMES
14166  .typeName = "FindServersResponse",
14167 #endif
14168  .memSize = sizeof(UA_FindServersResponse),
14169  .builtin = false,
14170  .fixedSize = false,
14171  .overlayable = false,
14172  .binaryEncodingId = 425,
14173  .membersSize = 2,
14174  .members = FindServersResponse_members },
14175 
14176 /* CreateMonitoredItemsRequest */
14177 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 749},
14179 #ifdef UA_ENABLE_TYPENAMES
14180  .typeName = "CreateMonitoredItemsRequest",
14181 #endif
14182  .memSize = sizeof(UA_CreateMonitoredItemsRequest),
14183  .builtin = false,
14184  .fixedSize = false,
14185  .overlayable = false,
14186  .binaryEncodingId = 751,
14187  .membersSize = 4,
14188  .members = CreateMonitoredItemsRequest_members },
14189 
14190 /* ContentFilter */
14191 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 586},
14192  .typeIndex = UA_TYPES_CONTENTFILTER,
14193 #ifdef UA_ENABLE_TYPENAMES
14194  .typeName = "ContentFilter",
14195 #endif
14196  .memSize = sizeof(UA_ContentFilter),
14197  .builtin = false,
14198  .fixedSize = false,
14199  .overlayable = false,
14200  .binaryEncodingId = 588,
14201  .membersSize = 1,
14202  .members = ContentFilter_members },
14203 
14204 /* QueryFirstResponse */
14205 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 616},
14206  .typeIndex = UA_TYPES_QUERYFIRSTRESPONSE,
14207 #ifdef UA_ENABLE_TYPENAMES
14208  .typeName = "QueryFirstResponse",
14209 #endif
14210  .memSize = sizeof(UA_QueryFirstResponse),
14211  .builtin = false,
14212  .fixedSize = false,
14213  .overlayable = false,
14214  .binaryEncodingId = 618,
14215  .membersSize = 6,
14216  .members = QueryFirstResponse_members },
14217 
14218 /* AddNodesRequest */
14219 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 486},
14220  .typeIndex = UA_TYPES_ADDNODESREQUEST,
14221 #ifdef UA_ENABLE_TYPENAMES
14222  .typeName = "AddNodesRequest",
14223 #endif
14224  .memSize = sizeof(UA_AddNodesRequest),
14225  .builtin = false,
14226  .fixedSize = false,
14227  .overlayable = false,
14228  .binaryEncodingId = 488,
14229  .membersSize = 2,
14230  .members = AddNodesRequest_members },
14231 
14232 /* BrowseRequest */
14233 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 525},
14234  .typeIndex = UA_TYPES_BROWSEREQUEST,
14235 #ifdef UA_ENABLE_TYPENAMES
14236  .typeName = "BrowseRequest",
14237 #endif
14238  .memSize = sizeof(UA_BrowseRequest),
14239  .builtin = false,
14240  .fixedSize = false,
14241  .overlayable = false,
14242  .binaryEncodingId = 527,
14243  .membersSize = 4,
14244  .members = BrowseRequest_members },
14245 
14246 /* BrowsePath */
14247 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 543},
14248  .typeIndex = UA_TYPES_BROWSEPATH,
14249 #ifdef UA_ENABLE_TYPENAMES
14250  .typeName = "BrowsePath",
14251 #endif
14252  .memSize = sizeof(UA_BrowsePath),
14253  .builtin = false,
14254  .fixedSize = false,
14255  .overlayable = false,
14256  .binaryEncodingId = 545,
14257  .membersSize = 2,
14258  .members = BrowsePath_members },
14259 
14260 /* BrowseResult */
14261 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 522},
14262  .typeIndex = UA_TYPES_BROWSERESULT,
14263 #ifdef UA_ENABLE_TYPENAMES
14264  .typeName = "BrowseResult",
14265 #endif
14266  .memSize = sizeof(UA_BrowseResult),
14267  .builtin = false,
14268  .fixedSize = false,
14269  .overlayable = false,
14270  .binaryEncodingId = 524,
14271  .membersSize = 3,
14272  .members = BrowseResult_members },
14273 
14274 /* CreateSessionRequest */
14275 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 459},
14276  .typeIndex = UA_TYPES_CREATESESSIONREQUEST,
14277 #ifdef UA_ENABLE_TYPENAMES
14278  .typeName = "CreateSessionRequest",
14279 #endif
14280  .memSize = sizeof(UA_CreateSessionRequest),
14281  .builtin = false,
14282  .fixedSize = false,
14283  .overlayable = false,
14284  .binaryEncodingId = 461,
14285  .membersSize = 9,
14286  .members = CreateSessionRequest_members },
14287 
14288 /* QueryDataDescription */
14289 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 570},
14290  .typeIndex = UA_TYPES_QUERYDATADESCRIPTION,
14291 #ifdef UA_ENABLE_TYPENAMES
14292  .typeName = "QueryDataDescription",
14293 #endif
14294  .memSize = sizeof(UA_QueryDataDescription),
14295  .builtin = false,
14296  .fixedSize = false,
14297  .overlayable = false,
14298  .binaryEncodingId = 572,
14299  .membersSize = 3,
14300  .members = QueryDataDescription_members },
14301 
14302 /* EndpointDescription */
14303 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 312},
14304  .typeIndex = UA_TYPES_ENDPOINTDESCRIPTION,
14305 #ifdef UA_ENABLE_TYPENAMES
14306  .typeName = "EndpointDescription",
14307 #endif
14308  .memSize = sizeof(UA_EndpointDescription),
14309  .builtin = false,
14310  .fixedSize = false,
14311  .overlayable = false,
14312  .binaryEncodingId = 314,
14313  .membersSize = 8,
14314  .members = EndpointDescription_members },
14315 
14316 /* GetEndpointsResponse */
14317 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 429},
14318  .typeIndex = UA_TYPES_GETENDPOINTSRESPONSE,
14319 #ifdef UA_ENABLE_TYPENAMES
14320  .typeName = "GetEndpointsResponse",
14321 #endif
14322  .memSize = sizeof(UA_GetEndpointsResponse),
14323  .builtin = false,
14324  .fixedSize = false,
14325  .overlayable = false,
14326  .binaryEncodingId = 431,
14327  .membersSize = 2,
14328  .members = GetEndpointsResponse_members },
14329 
14330 /* NodeTypeDescription */
14331 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 573},
14332  .typeIndex = UA_TYPES_NODETYPEDESCRIPTION,
14333 #ifdef UA_ENABLE_TYPENAMES
14334  .typeName = "NodeTypeDescription",
14335 #endif
14336  .memSize = sizeof(UA_NodeTypeDescription),
14337  .builtin = false,
14338  .fixedSize = false,
14339  .overlayable = false,
14340  .binaryEncodingId = 575,
14341  .membersSize = 3,
14342  .members = NodeTypeDescription_members },
14343 
14344 /* BrowseNextResponse */
14345 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 534},
14346  .typeIndex = UA_TYPES_BROWSENEXTRESPONSE,
14347 #ifdef UA_ENABLE_TYPENAMES
14348  .typeName = "BrowseNextResponse",
14349 #endif
14350  .memSize = sizeof(UA_BrowseNextResponse),
14351  .builtin = false,
14352  .fixedSize = false,
14353  .overlayable = false,
14354  .binaryEncodingId = 536,
14355  .membersSize = 3,
14356  .members = BrowseNextResponse_members },
14357 
14358 /* TranslateBrowsePathsToNodeIdsRequest */
14359 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 552},
14361 #ifdef UA_ENABLE_TYPENAMES
14362  .typeName = "TranslateBrowsePathsToNodeIdsRequest",
14363 #endif
14364  .memSize = sizeof(UA_TranslateBrowsePathsToNodeIdsRequest),
14365  .builtin = false,
14366  .fixedSize = false,
14367  .overlayable = false,
14368  .binaryEncodingId = 554,
14369  .membersSize = 2,
14370  .members = TranslateBrowsePathsToNodeIdsRequest_members },
14371 
14372 /* BrowseResponse */
14373 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 528},
14374  .typeIndex = UA_TYPES_BROWSERESPONSE,
14375 #ifdef UA_ENABLE_TYPENAMES
14376  .typeName = "BrowseResponse",
14377 #endif
14378  .memSize = sizeof(UA_BrowseResponse),
14379  .builtin = false,
14380  .fixedSize = false,
14381  .overlayable = false,
14382  .binaryEncodingId = 530,
14383  .membersSize = 3,
14384  .members = BrowseResponse_members },
14385 
14386 /* CreateSessionResponse */
14387 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 462},
14388  .typeIndex = UA_TYPES_CREATESESSIONRESPONSE,
14389 #ifdef UA_ENABLE_TYPENAMES
14390  .typeName = "CreateSessionResponse",
14391 #endif
14392  .memSize = sizeof(UA_CreateSessionResponse),
14393  .builtin = false,
14394  .fixedSize = false,
14395  .overlayable = false,
14396  .binaryEncodingId = 464,
14397  .membersSize = 10,
14398  .members = CreateSessionResponse_members },
14399 
14400 /* QueryFirstRequest */
14401 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 613},
14402  .typeIndex = UA_TYPES_QUERYFIRSTREQUEST,
14403 #ifdef UA_ENABLE_TYPENAMES
14404  .typeName = "QueryFirstRequest",
14405 #endif
14406  .memSize = sizeof(UA_QueryFirstRequest),
14407  .builtin = false,
14408  .fixedSize = false,
14409  .overlayable = false,
14410  .binaryEncodingId = 615,
14411  .membersSize = 6,
14412  .members = QueryFirstRequest_members },
14413 };
14414 
14415 
14416 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_transport_generated.c" ***********************************/
14417 
14418 /* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
14419  * on host iosb-VirtualBox by user iosb at 2018-11-29 10:33:06 */
14420 
14421 
14422 /* SecureConversationMessageAbortBody */
14423 static UA_DataTypeMember SecureConversationMessageAbortBody_members[2] = {
14425 #ifdef UA_ENABLE_TYPENAMES
14426  .memberName = "error",
14427 #endif
14428  .namespaceZero = true,
14429  .padding = 0,
14430  .isArray = false
14431  },
14432  { .memberTypeIndex = UA_TYPES_STRING,
14433 #ifdef UA_ENABLE_TYPENAMES
14434  .memberName = "reason",
14435 #endif
14436  .namespaceZero = true,
14437  .padding = offsetof(UA_SecureConversationMessageAbortBody, reason) - offsetof(UA_SecureConversationMessageAbortBody, error) - sizeof(UA_UInt32),
14438  .isArray = false
14439  },};
14440 
14441 /* SecureConversationMessageFooter */
14442 static UA_DataTypeMember SecureConversationMessageFooter_members[2] = {
14444 #ifdef UA_ENABLE_TYPENAMES
14445  .memberName = "padding",
14446 #endif
14447  .namespaceZero = true,
14448  .padding = 0,
14449  .isArray = true
14450  },
14451  { .memberTypeIndex = UA_TYPES_BYTE,
14452 #ifdef UA_ENABLE_TYPENAMES
14453  .memberName = "signature",
14454 #endif
14455  .namespaceZero = true,
14456  .padding = offsetof(UA_SecureConversationMessageFooter, signature) - offsetof(UA_SecureConversationMessageFooter, padding) - sizeof(void*),
14457  .isArray = false
14458  },};
14459 
14460 /* TcpHelloMessage */
14461 static UA_DataTypeMember TcpHelloMessage_members[6] = {
14463 #ifdef UA_ENABLE_TYPENAMES
14464  .memberName = "protocolVersion",
14465 #endif
14466  .namespaceZero = true,
14467  .padding = 0,
14468  .isArray = false
14469  },
14470  { .memberTypeIndex = UA_TYPES_UINT32,
14471 #ifdef UA_ENABLE_TYPENAMES
14472  .memberName = "receiveBufferSize",
14473 #endif
14474  .namespaceZero = true,
14475  .padding = offsetof(UA_TcpHelloMessage, receiveBufferSize) - offsetof(UA_TcpHelloMessage, protocolVersion) - sizeof(UA_UInt32),
14476  .isArray = false
14477  },
14478  { .memberTypeIndex = UA_TYPES_UINT32,
14479 #ifdef UA_ENABLE_TYPENAMES
14480  .memberName = "sendBufferSize",
14481 #endif
14482  .namespaceZero = true,
14483  .padding = offsetof(UA_TcpHelloMessage, sendBufferSize) - offsetof(UA_TcpHelloMessage, receiveBufferSize) - sizeof(UA_UInt32),
14484  .isArray = false
14485  },
14486  { .memberTypeIndex = UA_TYPES_UINT32,
14487 #ifdef UA_ENABLE_TYPENAMES
14488  .memberName = "maxMessageSize",
14489 #endif
14490  .namespaceZero = true,
14491  .padding = offsetof(UA_TcpHelloMessage, maxMessageSize) - offsetof(UA_TcpHelloMessage, sendBufferSize) - sizeof(UA_UInt32),
14492  .isArray = false
14493  },
14494  { .memberTypeIndex = UA_TYPES_UINT32,
14495 #ifdef UA_ENABLE_TYPENAMES
14496  .memberName = "maxChunkCount",
14497 #endif
14498  .namespaceZero = true,
14499  .padding = offsetof(UA_TcpHelloMessage, maxChunkCount) - offsetof(UA_TcpHelloMessage, maxMessageSize) - sizeof(UA_UInt32),
14500  .isArray = false
14501  },
14502  { .memberTypeIndex = UA_TYPES_STRING,
14503 #ifdef UA_ENABLE_TYPENAMES
14504  .memberName = "endpointUrl",
14505 #endif
14506  .namespaceZero = true,
14507  .padding = offsetof(UA_TcpHelloMessage, endpointUrl) - offsetof(UA_TcpHelloMessage, maxChunkCount) - sizeof(UA_UInt32),
14508  .isArray = false
14509  },};
14510 
14511 /* TcpErrorMessage */
14512 static UA_DataTypeMember TcpErrorMessage_members[2] = {
14514 #ifdef UA_ENABLE_TYPENAMES
14515  .memberName = "error",
14516 #endif
14517  .namespaceZero = true,
14518  .padding = 0,
14519  .isArray = false
14520  },
14521  { .memberTypeIndex = UA_TYPES_STRING,
14522 #ifdef UA_ENABLE_TYPENAMES
14523  .memberName = "reason",
14524 #endif
14525  .namespaceZero = true,
14526  .padding = offsetof(UA_TcpErrorMessage, reason) - offsetof(UA_TcpErrorMessage, error) - sizeof(UA_UInt32),
14527  .isArray = false
14528  },};
14529 
14530 /* MessageType */
14531 static UA_DataTypeMember MessageType_members[1] = {
14533 #ifdef UA_ENABLE_TYPENAMES
14534  .memberName = "",
14535 #endif
14536  .namespaceZero = true,
14537  .padding = 0,
14538  .isArray = false
14539  },};
14540 
14541 /* AsymmetricAlgorithmSecurityHeader */
14542 static UA_DataTypeMember AsymmetricAlgorithmSecurityHeader_members[3] = {
14544 #ifdef UA_ENABLE_TYPENAMES
14545  .memberName = "securityPolicyUri",
14546 #endif
14547  .namespaceZero = true,
14548  .padding = 0,
14549  .isArray = false
14550  },
14551  { .memberTypeIndex = UA_TYPES_BYTESTRING,
14552 #ifdef UA_ENABLE_TYPENAMES
14553  .memberName = "senderCertificate",
14554 #endif
14555  .namespaceZero = true,
14556  .padding = offsetof(UA_AsymmetricAlgorithmSecurityHeader, senderCertificate) - offsetof(UA_AsymmetricAlgorithmSecurityHeader, securityPolicyUri) - sizeof(UA_ByteString),
14557  .isArray = false
14558  },
14559  { .memberTypeIndex = UA_TYPES_BYTESTRING,
14560 #ifdef UA_ENABLE_TYPENAMES
14561  .memberName = "receiverCertificateThumbprint",
14562 #endif
14563  .namespaceZero = true,
14564  .padding = offsetof(UA_AsymmetricAlgorithmSecurityHeader, receiverCertificateThumbprint) - offsetof(UA_AsymmetricAlgorithmSecurityHeader, senderCertificate) - sizeof(UA_ByteString),
14565  .isArray = false
14566  },};
14567 
14568 /* TcpAcknowledgeMessage */
14569 static UA_DataTypeMember TcpAcknowledgeMessage_members[5] = {
14571 #ifdef UA_ENABLE_TYPENAMES
14572  .memberName = "protocolVersion",
14573 #endif
14574  .namespaceZero = true,
14575  .padding = 0,
14576  .isArray = false
14577  },
14578  { .memberTypeIndex = UA_TYPES_UINT32,
14579 #ifdef UA_ENABLE_TYPENAMES
14580  .memberName = "receiveBufferSize",
14581 #endif
14582  .namespaceZero = true,
14583  .padding = offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) - offsetof(UA_TcpAcknowledgeMessage, protocolVersion) - sizeof(UA_UInt32),
14584  .isArray = false
14585  },
14586  { .memberTypeIndex = UA_TYPES_UINT32,
14587 #ifdef UA_ENABLE_TYPENAMES
14588  .memberName = "sendBufferSize",
14589 #endif
14590  .namespaceZero = true,
14591  .padding = offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) - offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) - sizeof(UA_UInt32),
14592  .isArray = false
14593  },
14594  { .memberTypeIndex = UA_TYPES_UINT32,
14595 #ifdef UA_ENABLE_TYPENAMES
14596  .memberName = "maxMessageSize",
14597 #endif
14598  .namespaceZero = true,
14599  .padding = offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) - offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) - sizeof(UA_UInt32),
14600  .isArray = false
14601  },
14602  { .memberTypeIndex = UA_TYPES_UINT32,
14603 #ifdef UA_ENABLE_TYPENAMES
14604  .memberName = "maxChunkCount",
14605 #endif
14606  .namespaceZero = true,
14607  .padding = offsetof(UA_TcpAcknowledgeMessage, maxChunkCount) - offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) - sizeof(UA_UInt32),
14608  .isArray = false
14609  },};
14610 
14611 /* SequenceHeader */
14612 static UA_DataTypeMember SequenceHeader_members[2] = {
14614 #ifdef UA_ENABLE_TYPENAMES
14615  .memberName = "sequenceNumber",
14616 #endif
14617  .namespaceZero = true,
14618  .padding = 0,
14619  .isArray = false
14620  },
14621  { .memberTypeIndex = UA_TYPES_UINT32,
14622 #ifdef UA_ENABLE_TYPENAMES
14623  .memberName = "requestId",
14624 #endif
14625  .namespaceZero = true,
14626  .padding = offsetof(UA_SequenceHeader, requestId) - offsetof(UA_SequenceHeader, sequenceNumber) - sizeof(UA_UInt32),
14627  .isArray = false
14628  },};
14629 
14630 /* TcpMessageHeader */
14631 static UA_DataTypeMember TcpMessageHeader_members[2] = {
14633 #ifdef UA_ENABLE_TYPENAMES
14634  .memberName = "messageTypeAndChunkType",
14635 #endif
14636  .namespaceZero = true,
14637  .padding = 0,
14638  .isArray = false
14639  },
14640  { .memberTypeIndex = UA_TYPES_UINT32,
14641 #ifdef UA_ENABLE_TYPENAMES
14642  .memberName = "messageSize",
14643 #endif
14644  .namespaceZero = true,
14645  .padding = offsetof(UA_TcpMessageHeader, messageSize) - offsetof(UA_TcpMessageHeader, messageTypeAndChunkType) - sizeof(UA_UInt32),
14646  .isArray = false
14647  },};
14648 
14649 /* ChunkType */
14650 static UA_DataTypeMember ChunkType_members[1] = {
14652 #ifdef UA_ENABLE_TYPENAMES
14653  .memberName = "",
14654 #endif
14655  .namespaceZero = true,
14656  .padding = 0,
14657  .isArray = false
14658  },};
14659 
14660 /* SymmetricAlgorithmSecurityHeader */
14661 static UA_DataTypeMember SymmetricAlgorithmSecurityHeader_members[1] = {
14663 #ifdef UA_ENABLE_TYPENAMES
14664  .memberName = "tokenId",
14665 #endif
14666  .namespaceZero = true,
14667  .padding = 0,
14668  .isArray = false
14669  },};
14670 
14671 /* SecureConversationMessageHeader */
14672 static UA_DataTypeMember SecureConversationMessageHeader_members[2] = {
14674 #ifdef UA_ENABLE_TYPENAMES
14675  .memberName = "messageHeader",
14676 #endif
14677  .namespaceZero = false,
14678  .padding = 0,
14679  .isArray = false
14680  },
14681  { .memberTypeIndex = UA_TYPES_UINT32,
14682 #ifdef UA_ENABLE_TYPENAMES
14683  .memberName = "secureChannelId",
14684 #endif
14685  .namespaceZero = true,
14686  .padding = offsetof(UA_SecureConversationMessageHeader, secureChannelId) - offsetof(UA_SecureConversationMessageHeader, messageHeader) - sizeof(UA_TcpMessageHeader),
14687  .isArray = false
14688  },};
14689 const UA_DataType UA_TRANSPORT[UA_TRANSPORT_COUNT] = {
14690 
14691 /* SecureConversationMessageAbortBody */
14692 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14694 #ifdef UA_ENABLE_TYPENAMES
14695  .typeName = "SecureConversationMessageAbortBody",
14696 #endif
14697  .memSize = sizeof(UA_SecureConversationMessageAbortBody),
14698  .builtin = false,
14699  .fixedSize = false,
14700  .overlayable = false,
14701  .binaryEncodingId = 0,
14702  .membersSize = 2,
14703  .members = SecureConversationMessageAbortBody_members },
14704 
14705 /* SecureConversationMessageFooter */
14706 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14708 #ifdef UA_ENABLE_TYPENAMES
14709  .typeName = "SecureConversationMessageFooter",
14710 #endif
14711  .memSize = sizeof(UA_SecureConversationMessageFooter),
14712  .builtin = false,
14713  .fixedSize = false,
14714  .overlayable = false,
14715  .binaryEncodingId = 0,
14716  .membersSize = 2,
14717  .members = SecureConversationMessageFooter_members },
14718 
14719 /* TcpHelloMessage */
14720 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14721  .typeIndex = UA_TRANSPORT_TCPHELLOMESSAGE,
14722 #ifdef UA_ENABLE_TYPENAMES
14723  .typeName = "TcpHelloMessage",
14724 #endif
14725  .memSize = sizeof(UA_TcpHelloMessage),
14726  .builtin = false,
14727  .fixedSize = false,
14728  .overlayable = false,
14729  .binaryEncodingId = 0,
14730  .membersSize = 6,
14731  .members = TcpHelloMessage_members },
14732 
14733 /* TcpErrorMessage */
14734 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14735  .typeIndex = UA_TRANSPORT_TCPERRORMESSAGE,
14736 #ifdef UA_ENABLE_TYPENAMES
14737  .typeName = "TcpErrorMessage",
14738 #endif
14739  .memSize = sizeof(UA_TcpErrorMessage),
14740  .builtin = false,
14741  .fixedSize = false,
14742  .overlayable = false,
14743  .binaryEncodingId = 0,
14744  .membersSize = 2,
14745  .members = TcpErrorMessage_members },
14746 
14747 /* MessageType */
14748 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14749  .typeIndex = UA_TYPES_INT32,
14750 #ifdef UA_ENABLE_TYPENAMES
14751  .typeName = "MessageType",
14752 #endif
14753  .memSize = sizeof(UA_MessageType),
14754  .builtin = true,
14755  .fixedSize = true,
14756  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
14757  .binaryEncodingId = 0,
14758  .membersSize = 1,
14759  .members = MessageType_members },
14760 
14761 /* AsymmetricAlgorithmSecurityHeader */
14762 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14764 #ifdef UA_ENABLE_TYPENAMES
14765  .typeName = "AsymmetricAlgorithmSecurityHeader",
14766 #endif
14767  .memSize = sizeof(UA_AsymmetricAlgorithmSecurityHeader),
14768  .builtin = false,
14769  .fixedSize = false,
14770  .overlayable = false,
14771  .binaryEncodingId = 0,
14772  .membersSize = 3,
14773  .members = AsymmetricAlgorithmSecurityHeader_members },
14774 
14775 /* TcpAcknowledgeMessage */
14776 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14778 #ifdef UA_ENABLE_TYPENAMES
14779  .typeName = "TcpAcknowledgeMessage",
14780 #endif
14781  .memSize = sizeof(UA_TcpAcknowledgeMessage),
14782  .builtin = false,
14783  .fixedSize = true,
14784  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) == (offsetof(UA_TcpAcknowledgeMessage, protocolVersion) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) == (offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) == (offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpAcknowledgeMessage, maxChunkCount) == (offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) + sizeof(UA_UInt32)),
14785  .binaryEncodingId = 0,
14786  .membersSize = 5,
14787  .members = TcpAcknowledgeMessage_members },
14788 
14789 /* SequenceHeader */
14790 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14791  .typeIndex = UA_TRANSPORT_SEQUENCEHEADER,
14792 #ifdef UA_ENABLE_TYPENAMES
14793  .typeName = "SequenceHeader",
14794 #endif
14795  .memSize = sizeof(UA_SequenceHeader),
14796  .builtin = false,
14797  .fixedSize = true,
14798  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_SequenceHeader, requestId) == (offsetof(UA_SequenceHeader, sequenceNumber) + sizeof(UA_UInt32)),
14799  .binaryEncodingId = 0,
14800  .membersSize = 2,
14801  .members = SequenceHeader_members },
14802 
14803 /* TcpMessageHeader */
14804 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14805  .typeIndex = UA_TRANSPORT_TCPMESSAGEHEADER,
14806 #ifdef UA_ENABLE_TYPENAMES
14807  .typeName = "TcpMessageHeader",
14808 #endif
14809  .memSize = sizeof(UA_TcpMessageHeader),
14810  .builtin = false,
14811  .fixedSize = true,
14812  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpMessageHeader, messageSize) == (offsetof(UA_TcpMessageHeader, messageTypeAndChunkType) + sizeof(UA_UInt32)),
14813  .binaryEncodingId = 0,
14814  .membersSize = 2,
14815  .members = TcpMessageHeader_members },
14816 
14817 /* ChunkType */
14818 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14819  .typeIndex = UA_TYPES_INT32,
14820 #ifdef UA_ENABLE_TYPENAMES
14821  .typeName = "ChunkType",
14822 #endif
14823  .memSize = sizeof(UA_ChunkType),
14824  .builtin = true,
14825  .fixedSize = true,
14826  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
14827  .binaryEncodingId = 0,
14828  .membersSize = 1,
14829  .members = ChunkType_members },
14830 
14831 /* SymmetricAlgorithmSecurityHeader */
14832 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14834 #ifdef UA_ENABLE_TYPENAMES
14835  .typeName = "SymmetricAlgorithmSecurityHeader",
14836 #endif
14837  .memSize = sizeof(UA_SymmetricAlgorithmSecurityHeader),
14838  .builtin = false,
14839  .fixedSize = true,
14840  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER,
14841  .binaryEncodingId = 0,
14842  .membersSize = 1,
14843  .members = SymmetricAlgorithmSecurityHeader_members },
14844 
14845 /* SecureConversationMessageHeader */
14846 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14848 #ifdef UA_ENABLE_TYPENAMES
14849  .typeName = "SecureConversationMessageHeader",
14850 #endif
14851  .memSize = sizeof(UA_SecureConversationMessageHeader),
14852  .builtin = false,
14853  .fixedSize = true,
14854  .overlayable = true && true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpMessageHeader, messageSize) == (offsetof(UA_TcpMessageHeader, messageTypeAndChunkType) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_SecureConversationMessageHeader, secureChannelId) == (offsetof(UA_SecureConversationMessageHeader, messageHeader) + sizeof(UA_TcpMessageHeader)),
14855  .binaryEncodingId = 0,
14856  .membersSize = 2,
14857  .members = SecureConversationMessageHeader_members },
14858 };
14859 
14860 
14861 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_connection.c" ***********************************/
14862 
14863 /* This Source Code Form is subject to the terms of the Mozilla Public
14864 * License, v. 2.0. If a copy of the MPL was not distributed with this
14865 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
14866 
14867 
14869  UA_ByteString_deleteMembers(&connection->incompleteMessage);
14870 }
14871 
14874  UA_Boolean *realloced) {
14876 
14877  /* We have a stored an incomplete chunk. Concat the received message to the end.
14878  * After this block, connection->incompleteMessage is always empty. */
14879  if(connection->incompleteMessage.length > 0) {
14880  size_t length = connection->incompleteMessage.length + message->length;
14881  UA_Byte *data = (UA_Byte*)UA_realloc(connection->incompleteMessage.data, length);
14882  if(!data) {
14884  goto cleanup;
14885  }
14886  memcpy(&data[connection->incompleteMessage.length], message->data, message->length);
14887  connection->releaseRecvBuffer(connection, message);
14888  message->data = data;
14889  message->length = length;
14890  *realloced = true;
14891  connection->incompleteMessage = UA_BYTESTRING_NULL;
14892  }
14893 
14894  /* Loop over the chunks in the received buffer */
14895  size_t complete_until = 0; /* the received complete chunks end at this point */
14896  UA_Boolean garbage_end = false; /* garbage after the last complete message */
14897  while(message->length - complete_until >= 8) {
14898  /* Check the message type */
14899  UA_UInt32 msgtype = (UA_UInt32)message->data[complete_until] +
14900  ((UA_UInt32)message->data[complete_until+1] << 8) +
14901  ((UA_UInt32)message->data[complete_until+2] << 16);
14902  if(msgtype != ('M' + ('S' << 8) + ('G' << 16)) &&
14903  msgtype != ('E' + ('R' << 8) + ('R' << 16)) &&
14904  msgtype != ('O' + ('P' << 8) + ('N' << 16)) &&
14905  msgtype != ('H' + ('E' << 8) + ('L' << 16)) &&
14906  msgtype != ('A' + ('C' << 8) + ('K' << 16)) &&
14907  msgtype != ('C' + ('L' << 8) + ('O' << 16))) {
14908  garbage_end = true; /* the message type is not recognized */
14909  break;
14910  }
14911 
14912  /* Decode the length of the chunk */
14913  UA_UInt32 chunk_length = 0;
14914  size_t length_pos = complete_until + 4;
14915  UA_StatusCode decode_retval = UA_UInt32_decodeBinary(message, &length_pos, &chunk_length);
14916 
14917  /* The message size is not allowed. Throw the remaining bytestring away */
14918  if(decode_retval != UA_STATUSCODE_GOOD ||
14919  chunk_length < 16 ||
14920  chunk_length > connection->localConf.recvBufferSize) {
14921  garbage_end = true;
14922  break;
14923  }
14924 
14925  /* The chunk is okay but incomplete. Store the end. */
14926  if(chunk_length + complete_until > message->length)
14927  break;
14928 
14929  complete_until += chunk_length; /* Go to the next chunk */
14930  }
14931 
14932  /* Separate incomplete chunks */
14933  if(complete_until != message->length) {
14934  /* Garbage after the last good chunk. No need to keep a buffer */
14935  if(garbage_end) {
14936  if(complete_until == 0)
14937  goto cleanup; /* All garbage, only happens on messages from the network layer */
14938  message->length = complete_until;
14939  return UA_STATUSCODE_GOOD;
14940  }
14941 
14942  /* No good chunk, only an incomplete one */
14943  if(complete_until == 0) {
14944  if(!*realloced) {
14945  retval = UA_ByteString_allocBuffer(&connection->incompleteMessage, message->length);
14946  if(retval != UA_STATUSCODE_GOOD)
14947  goto cleanup;
14948  memcpy(connection->incompleteMessage.data, message->data, message->length);
14949  connection->releaseRecvBuffer(connection, message);
14950  *realloced = true;
14951  } else {
14952  connection->incompleteMessage = *message;
14953  *message = UA_BYTESTRING_NULL;
14954  }
14955  return UA_STATUSCODE_GOOD;
14956  }
14957 
14958  /* At least one good chunk and an incomplete one */
14959  size_t incomplete_length = message->length - complete_until;
14960  retval = UA_ByteString_allocBuffer(&connection->incompleteMessage, incomplete_length);
14961  if(retval != UA_STATUSCODE_GOOD)
14962  goto cleanup;
14963  memcpy(connection->incompleteMessage.data,
14964  &message->data[complete_until], incomplete_length);
14965  message->length = complete_until;
14966  }
14967 
14968  return UA_STATUSCODE_GOOD;
14969 
14970  cleanup:
14971  if(!*realloced)
14972  connection->releaseRecvBuffer(connection, message);
14973  UA_ByteString_deleteMembers(&connection->incompleteMessage);
14974  return retval;
14975 }
14976 
14979  UA_Boolean *realloced, UA_UInt32 timeout) {
14981  UA_DateTime maxDate = now + (timeout * UA_MSEC_TO_DATETIME);
14982  *realloced = false;
14983 
14985  while(true) {
14986  /* Listen for messages to arrive */
14987  retval = connection->recv(connection, chunks, timeout);
14988 
14989  /* Get complete chunks and return */
14990  retval |= UA_Connection_completeMessages(connection, chunks, realloced);
14991  if(retval != UA_STATUSCODE_GOOD || chunks->length > 0)
14992  break;
14993 
14994  /* We received a message. But the chunk is incomplete. Compute the
14995  * remaining timeout. */
14996  now = UA_DateTime_nowMonotonic();
14997  if(now > maxDate)
14999  timeout = (UA_UInt32)((maxDate - now) / UA_MSEC_TO_DATETIME);
15000  }
15001  return retval;
15002 }
15003 
15004 
15006  UA_SecureChannel *channel = connection->channel;
15007  if(channel)
15008  /* only replace when the channel points to this connection */
15009  UA_atomic_cmpxchg((void**)&channel->connection, connection, NULL);
15010  UA_atomic_xchg((void**)&connection->channel, NULL);
15011 }
15012 
15013 // TODO: Return an error code
15014 void
15016  UA_SecureChannel *channel) {
15017  if(UA_atomic_cmpxchg((void**)&channel->connection, NULL, connection) == NULL)
15018  UA_atomic_xchg((void**)&connection->channel, (void*)channel);
15019 }
15020 
15022 UA_EndpointUrl_split_ptr(const char *endpointUrl, char *hostname,
15023  const char ** port, const char **path) {
15024  if (!endpointUrl || !hostname)
15026 
15027  size_t urlLength = strlen(endpointUrl);
15028  if(urlLength < 10 || urlLength >= 256)
15030 
15031  if(strncmp(endpointUrl, "opc.tcp://", 10) != 0)
15033 
15034  if (urlLength == 10) {
15035  hostname[0] = '\0';
15036  port = NULL;
15037  *path = NULL;
15038  }
15039 
15040  /* where does the port begin? */
15041  size_t portpos = 10;
15042  // opc.tcp://[2001:0db8:85a3::8a2e:0370:7334]:1234/path
15043  // if ip6, then end not found, otherwise we are fine
15044  UA_Boolean ip6_end_found = endpointUrl[portpos] != '[';
15045  for(; portpos < urlLength; ++portpos) {
15046  if (!ip6_end_found) {
15047  if (endpointUrl[portpos] == ']')
15048  ip6_end_found = UA_TRUE;
15049  continue;
15050  }
15051 
15052  if(endpointUrl[portpos] == ':' || endpointUrl[portpos] == '/')
15053  break;
15054  }
15055 
15056  memcpy(hostname, &endpointUrl[10], portpos - 10);
15057  hostname[portpos-10] = 0;
15058 
15059  if(port) {
15060  if (portpos < urlLength - 1) {
15061  if (endpointUrl[portpos] == '/')
15062  *port = NULL;
15063  else
15064  *port = &endpointUrl[portpos + 1];
15065  } else {
15066  *port = NULL;
15067  }
15068  }
15069 
15070  if(path) {
15071  size_t pathpos = portpos < urlLength ? portpos : 10;
15072  for(; pathpos < urlLength; ++pathpos) {
15073  if(endpointUrl[pathpos] == '/')
15074  break;
15075  }
15076  if (pathpos < urlLength-1)
15077  *path = &endpointUrl[pathpos+1]; // do not include slash in path
15078  else
15079  *path = NULL;
15080  }
15081 
15082  return UA_STATUSCODE_GOOD;
15083 }
15084 
15085 
15087 UA_EndpointUrl_split(const char *endpointUrl, char *hostname,
15088  UA_UInt16 * port, const char ** path) {
15089  const char* portTmp = NULL;
15090  const char* pathTmp = NULL;
15091  UA_StatusCode retval = UA_EndpointUrl_split_ptr(endpointUrl, hostname, &portTmp, &pathTmp);
15092  if(retval != UA_STATUSCODE_GOOD) {
15093  if(hostname)
15094  hostname[0] = '\0';
15095  return retval;
15096  }
15097  if(!port && !path)
15098  return UA_STATUSCODE_GOOD;
15099 
15100  char portStr[6];
15101  portStr[0] = '\0';
15102  if(portTmp) {
15103  size_t portLen;
15104  if (pathTmp)
15105  portLen = (size_t)(pathTmp-portTmp-1);
15106  else
15107  portLen = strlen(portTmp);
15108 
15109  if (portLen > 5) // max is 65535
15111 
15112  memcpy(portStr, portTmp, portLen);
15113  portStr[portLen]='\0';
15114 
15115  if(port) {
15116  for (size_t i=0; i<6; ++i) {
15117  if (portStr[i] == 0)
15118  break;
15119  if (portStr[i] < '0' || portStr[i] > '9')
15121  }
15122 
15123  UA_UInt32 p;
15124  UA_readNumber((UA_Byte*)portStr, 6, &p);
15125  if (p>65535)
15127  *port = (UA_UInt16)p;
15128  }
15129  } else {
15130  if (port)
15131  *port = 0;
15132  }
15133  if (path)
15134  *path = pathTmp;
15135  return UA_STATUSCODE_GOOD;
15136 }
15137 
15138 size_t UA_readNumber(UA_Byte *buf, size_t buflen, UA_UInt32 *number) {
15139  if (!buf)
15140  return 0;
15141  UA_UInt32 n = 0;
15142  size_t progress = 0;
15143  /* read numbers until the end or a non-number character appears */
15144  while(progress < buflen) {
15145  UA_Byte c = buf[progress];
15146  if('0' > c || '9' < c)
15147  break;
15148  n = (n*10) + (UA_UInt32)(c-'0');
15149  ++progress;
15150  }
15151  *number = n;
15152  return progress;
15153 }
15154 
15155 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_securechannel.c" ***********************************/
15156 
15157 /* This Source Code Form is subject to the terms of the Mozilla Public
15158 * License, v. 2.0. If a copy of the MPL was not distributed with this
15159 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
15160 
15161 
15162 #define UA_SECURE_MESSAGE_HEADER_LENGTH 24
15163 
15165  memset(channel, 0, sizeof(UA_SecureChannel));
15166  /* Linked lists are also initialized by zeroing out */
15167  /* LIST_INIT(&channel->sessions); */
15168  /* LIST_INIT(&channel->chunks); */
15169 }
15170 
15172  /* Delete members */
15173  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&channel->serverAsymAlgSettings);
15174  UA_ByteString_deleteMembers(&channel->serverNonce);
15175  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&channel->clientAsymAlgSettings);
15176  UA_ByteString_deleteMembers(&channel->clientNonce);
15177  UA_ChannelSecurityToken_deleteMembers(&channel->securityToken);
15178  UA_ChannelSecurityToken_deleteMembers(&channel->nextSecurityToken);
15179 
15180  /* Detach from the channel */
15181  if(channel->connection)
15183 
15184  /* Remove session pointers (not the sessions) */
15185  struct SessionEntry *se, *temp;
15186  LIST_FOREACH_SAFE(se, &channel->sessions, pointers, temp) {
15187  if(se->session)
15188  se->session->channel = NULL;
15189  LIST_REMOVE(se, pointers);
15190  UA_free(se);
15191  }
15192 
15193  /* Remove the buffered chunks */
15194  struct ChunkEntry *ch, *temp_ch;
15195  LIST_FOREACH_SAFE(ch, &channel->chunks, pointers, temp_ch) {
15196  UA_ByteString_deleteMembers(&ch->bytes);
15197  LIST_REMOVE(ch, pointers);
15198  UA_free(ch);
15199  }
15200 }
15201 
15202 //TODO implement real nonce generator - DUMMY function
15204  if(!(nonce->data = UA_malloc(1)))
15206  nonce->length = 1;
15207  nonce->data[0] = 'a';
15208  return UA_STATUSCODE_GOOD;
15209 }
15210 
15211 #if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
15212 #pragma GCC diagnostic push
15213 #pragma GCC diagnostic ignored "-Wextra"
15214 #pragma GCC diagnostic ignored "-Wcast-qual"
15215 #pragma GCC diagnostic ignored "-Wunused-value"
15216 #endif
15217 
15218 void UA_SecureChannel_attachSession(UA_SecureChannel *channel, UA_Session *session) {
15219  struct SessionEntry *se = UA_malloc(sizeof(struct SessionEntry));
15220  if(!se)
15221  return;
15222  se->session = session;
15223  if(UA_atomic_cmpxchg((void**)&session->channel, NULL, channel) != NULL) {
15224  UA_free(se);
15225  return;
15226  }
15227  LIST_INSERT_HEAD(&channel->sessions, se, pointers);
15228 }
15229 
15230 #if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
15231 #pragma GCC diagnostic pop
15232 #endif
15233 
15234 void UA_SecureChannel_detachSession(UA_SecureChannel *channel, UA_Session *session) {
15235  if(session)
15236  session->channel = NULL;
15237  struct SessionEntry *se;
15238  LIST_FOREACH(se, &channel->sessions, pointers) {
15239  if(se->session == session)
15240  break;
15241  }
15242  if(!se)
15243  return;
15244  LIST_REMOVE(se, pointers);
15245  UA_free(se);
15246 }
15247 
15249  struct SessionEntry *se;
15250  LIST_FOREACH(se, &channel->sessions, pointers) {
15251  if(UA_NodeId_equal(&se->session->authenticationToken, token))
15252  break;
15253  }
15254  if(!se)
15255  return NULL;
15256  return se->session;
15257 }
15258 
15260  if(channel->nextSecurityToken.tokenId == 0) //no security token issued
15261  return;
15262 
15263  //FIXME: not thread-safe
15264  memcpy(&channel->securityToken, &channel->nextSecurityToken,
15265  sizeof(UA_ChannelSecurityToken));
15266  UA_ChannelSecurityToken_init(&channel->nextSecurityToken);
15267 }
15268 
15269 /***********************/
15270 /* Send Binary Message */
15271 /***********************/
15272 
15273 static UA_StatusCode
15274 UA_SecureChannel_sendChunk(UA_ChunkInfo *ci, UA_ByteString *dst, size_t offset) {
15275  UA_SecureChannel *channel = ci->channel;
15276  UA_Connection *connection = channel->connection;
15277  if(!connection)
15279 
15280  /* adjust the buffer where the header was hidden */
15281  dst->data = &dst->data[-UA_SECURE_MESSAGE_HEADER_LENGTH];
15284 
15285  if(ci->messageSizeSoFar + offset > connection->remoteConf.maxMessageSize &&
15286  connection->remoteConf.maxMessageSize > 0)
15288  if(++ci->chunksSoFar > connection->remoteConf.maxChunkCount &&
15289  connection->remoteConf.maxChunkCount > 0)
15291 
15292  /* Prepare the chunk headers */
15294  respHeader.secureChannelId = channel->securityToken.channelId;
15296  if(ci->errorCode == UA_STATUSCODE_GOOD) {
15297  if(ci->final)
15299  else
15301  } else {
15302  /* abort message */
15303  ci->final = true; /* mark as finished */
15305  UA_String errorMsg;
15306  UA_String_init(&errorMsg);
15308  UA_UInt32_encodeBinary(&ci->errorCode, dst, &offset);
15309  UA_String_encodeBinary(&errorMsg, dst, &offset);
15310  }
15311  respHeader.messageHeader.messageSize = (UA_UInt32)offset;
15312  ci->messageSizeSoFar += offset;
15313 
15314  /* Encode the header at the beginning of the buffer */
15316  symSecHeader.tokenId = channel->securityToken.tokenId;
15317  UA_SequenceHeader seqHeader;
15318  seqHeader.requestId = ci->requestId;
15319  seqHeader.sequenceNumber = UA_atomic_add(&channel->sendSequenceNumber, 1);
15320  size_t offset_header = 0;
15321  UA_SecureConversationMessageHeader_encodeBinary(&respHeader, dst, &offset_header);
15322  UA_SymmetricAlgorithmSecurityHeader_encodeBinary(&symSecHeader, dst, &offset_header);
15323  UA_SequenceHeader_encodeBinary(&seqHeader, dst, &offset_header);
15324 
15325  /* Send the chunk, the buffer is freed in the network layer */
15326  dst->length = offset; /* set the buffer length to the content length */
15327  connection->send(channel->connection, dst);
15328 
15329  /* Replace with the buffer for the next chunk */
15330  if(!ci->final) {
15331  UA_StatusCode retval =
15332  connection->getSendBuffer(connection, connection->localConf.sendBufferSize, dst);
15333  if(retval != UA_STATUSCODE_GOOD)
15334  return retval;
15335  /* Forward the data pointer so that the payload is encoded after the message header.
15336  * TODO: This works but is a bit too clever. Instead, we could return an offset to the
15337  * binary encoding exchangeBuffer function. */
15340  }
15341  return ci->errorCode;
15342 }
15343 
15346  const void *content, const UA_DataType *contentType) {
15347  UA_Connection *connection = channel->connection;
15348  if(!connection)
15350 
15351  /* Allocate the message buffer */
15352  UA_ByteString message;
15353  UA_StatusCode retval =
15354  connection->getSendBuffer(connection, connection->localConf.sendBufferSize, &message);
15355  if(retval != UA_STATUSCODE_GOOD)
15356  return retval;
15357 
15358  /* Hide the message beginning where the header will be encoded */
15359  message.data = &message.data[UA_SECURE_MESSAGE_HEADER_LENGTH];
15361 
15362  /* Encode the message type */
15363  size_t messagePos = 0;
15364  UA_NodeId typeId = contentType->typeId; /* always numeric */
15365  typeId.identifier.numeric = contentType->binaryEncodingId;
15366  UA_NodeId_encodeBinary(&typeId, &message, &messagePos);
15367 
15368  /* Encode with the chunking callback */
15369  UA_ChunkInfo ci;
15370  ci.channel = channel;
15371  ci.requestId = requestId;
15372  ci.chunksSoFar = 0;
15373  ci.messageSizeSoFar = 0;
15374  ci.final = false;
15377  if(typeId.identifier.numeric == 446 || typeId.identifier.numeric == 449)
15379  else if(typeId.identifier.numeric == 452 || typeId.identifier.numeric == 455)
15381  retval = UA_encodeBinary(content, contentType,
15382  (UA_exchangeEncodeBuffer)UA_SecureChannel_sendChunk,
15383  &ci, &message, &messagePos);
15384 
15385  /* Encoding failed, release the message */
15386  if(retval != UA_STATUSCODE_GOOD) {
15387  if(!ci.final) {
15388  /* the abort message was not send */
15389  ci.errorCode = retval;
15390  UA_SecureChannel_sendChunk(&ci, &message, messagePos);
15391  }
15392  return retval;
15393  }
15394 
15395  /* Encoding finished, send the final chunk */
15396  ci.final = UA_TRUE;
15397  return UA_SecureChannel_sendChunk(&ci, &message, messagePos);
15398 }
15399 
15400 /***************************/
15401 /* Process Received Chunks */
15402 /***************************/
15403 
15404 static void
15405 UA_SecureChannel_removeChunk(UA_SecureChannel *channel, UA_UInt32 requestId) {
15406  struct ChunkEntry *ch;
15407  LIST_FOREACH(ch, &channel->chunks, pointers) {
15408  if(ch->requestId == requestId) {
15409  UA_ByteString_deleteMembers(&ch->bytes);
15410  LIST_REMOVE(ch, pointers);
15411  UA_free(ch);
15412  return;
15413  }
15414  }
15415 }
15416 
15417 /* assume that chunklength fits */
15418 static void
15419 appendChunk(struct ChunkEntry *ch, const UA_ByteString *msg,
15420  size_t offset, size_t chunklength) {
15421  UA_Byte* new_bytes = UA_realloc(ch->bytes.data, ch->bytes.length + chunklength);
15422  if(!new_bytes) {
15423  UA_ByteString_deleteMembers(&ch->bytes);
15424  return;
15425  }
15426  ch->bytes.data = new_bytes;
15427  memcpy(&ch->bytes.data[ch->bytes.length], &msg->data[offset], chunklength);
15428  ch->bytes.length += chunklength;
15429 }
15430 
15431 static void
15432 UA_SecureChannel_appendChunk(UA_SecureChannel *channel, UA_UInt32 requestId,
15433  const UA_ByteString *msg, size_t offset,
15434  size_t chunklength) {
15435  /* Check if the chunk fits into the message */
15436  if(msg->length - offset < chunklength) {
15437  /* can't process all chunks for that request */
15438  UA_SecureChannel_removeChunk(channel, requestId);
15439  return;
15440  }
15441 
15442  /* Get the chunkentry */
15443  struct ChunkEntry *ch;
15444  LIST_FOREACH(ch, &channel->chunks, pointers) {
15445  if(ch->requestId == requestId)
15446  break;
15447  }
15448 
15449  /* No chunkentry on the channel, create one */
15450  if(!ch) {
15451  ch = UA_malloc(sizeof(struct ChunkEntry));
15452  if(!ch)
15453  return;
15454  ch->requestId = requestId;
15455  UA_ByteString_init(&ch->bytes);
15456  LIST_INSERT_HEAD(&channel->chunks, ch, pointers);
15457  }
15458 
15459  appendChunk(ch, msg, offset, chunklength);
15460 }
15461 
15462 static UA_ByteString
15463 UA_SecureChannel_finalizeChunk(UA_SecureChannel *channel, UA_UInt32 requestId,
15464  const UA_ByteString *msg, size_t offset,
15465  size_t chunklength, UA_Boolean *deleteChunk) {
15466  if(msg->length - offset < chunklength) {
15467  /* can't process all chunks for that request */
15468  UA_SecureChannel_removeChunk(channel, requestId);
15469  return UA_BYTESTRING_NULL;
15470  }
15471 
15472  struct ChunkEntry *ch;
15473  LIST_FOREACH(ch, &channel->chunks, pointers) {
15474  if(ch->requestId == requestId)
15475  break;
15476  }
15477 
15478  UA_ByteString bytes;
15479  if(!ch) {
15480  *deleteChunk = false;
15481  bytes.length = chunklength;
15482  bytes.data = msg->data + offset;
15483  } else {
15484  *deleteChunk = true;
15485  appendChunk(ch, msg, offset, chunklength);
15486  bytes = ch->bytes;
15487  LIST_REMOVE(ch, pointers);
15488  UA_free(ch);
15489  }
15490  return bytes;
15491 }
15492 
15493 static UA_StatusCode
15494 UA_SecureChannel_processSequenceNumber(UA_SecureChannel *channel, UA_UInt32 SequenceNumber) {
15495  /* Does the sequence number match? */
15496  if(SequenceNumber != channel->receiveSequenceNumber + 1) {
15497  if(channel->receiveSequenceNumber + 1 > 4294966271 && SequenceNumber < 1024)
15498  channel->receiveSequenceNumber = SequenceNumber - 1; /* Roll over */
15499  else
15501  }
15502  ++channel->receiveSequenceNumber;
15503  return UA_STATUSCODE_GOOD;
15504 }
15505 
15508  UA_ProcessMessageCallback callback, void *application) {
15510  size_t offset= 0;
15511  do {
15512 
15513  if (chunks->length > 3 && chunks->data[offset] == 'E' &&
15514  chunks->data[offset+1] == 'R' && chunks->data[offset+2] == 'R') {
15515  UA_TcpMessageHeader header;
15516  retval = UA_TcpMessageHeader_decodeBinary(chunks, &offset, &header);
15517  if(retval != UA_STATUSCODE_GOOD)
15518  break;
15519 
15520  UA_TcpErrorMessage errorMessage;
15521  retval = UA_TcpErrorMessage_decodeBinary(chunks, &offset, &errorMessage);
15522  if(retval != UA_STATUSCODE_GOOD)
15523  break;
15524 
15525  callback(application, channel, UA_MESSAGETYPE_ERR, 0, (void*)&errorMessage);
15526  continue;
15527  }
15528 
15529  /* Store the initial offset to compute the header length */
15530  size_t initial_offset = offset;
15531 
15532  /* Decode header */
15534  retval = UA_SecureConversationMessageHeader_decodeBinary(chunks, &offset, &header);
15535  if(retval != UA_STATUSCODE_GOOD)
15536  break;
15537 
15538  /* Is the channel attached to connection? */
15539  if(header.secureChannelId != channel->securityToken.channelId) {
15540  //Service_CloseSecureChannel(server, channel);
15541  //connection->close(connection);
15543  }
15544 
15545  /* Use requestId = 0 with OPN as argument for the callback */
15546  UA_SequenceHeader sequenceHeader;
15547  UA_SequenceHeader_init(&sequenceHeader);
15548 
15549  if((header.messageHeader.messageTypeAndChunkType & 0x00ffffff) != UA_MESSAGETYPE_OPN) {
15550  /* Check the symmetric security header (not for OPN) */
15551  UA_UInt32 tokenId = 0;
15552  retval |= UA_UInt32_decodeBinary(chunks, &offset, &tokenId);
15553  retval |= UA_SequenceHeader_decodeBinary(chunks, &offset, &sequenceHeader);
15554  if(retval != UA_STATUSCODE_GOOD)
15556 
15557  /* Does the token match? */
15558  if(tokenId != channel->securityToken.tokenId) {
15559  if(tokenId != channel->nextSecurityToken.tokenId)
15562  }
15563 
15564  /* Does the sequence number match? */
15565  retval = UA_SecureChannel_processSequenceNumber(channel, sequenceHeader.sequenceNumber);
15566  if(retval != UA_STATUSCODE_GOOD)
15568  }
15569 
15570  /* Process chunk */
15571  size_t processed_header = offset - initial_offset;
15572  switch(header.messageHeader.messageTypeAndChunkType & 0xff000000) {
15574  UA_SecureChannel_appendChunk(channel, sequenceHeader.requestId, chunks, offset,
15575  header.messageHeader.messageSize - processed_header);
15576  break;
15577  case UA_CHUNKTYPE_FINAL: {
15578  UA_Boolean realloced = false;
15579  UA_ByteString message =
15580  UA_SecureChannel_finalizeChunk(channel, sequenceHeader.requestId, chunks, offset,
15581  header.messageHeader.messageSize - processed_header,
15582  &realloced);
15583  if(message.length > 0) {
15584  callback(application, channel, header.messageHeader.messageTypeAndChunkType & 0x00ffffff,
15585  sequenceHeader.requestId, &message);
15586  if(realloced)
15587  UA_ByteString_deleteMembers(&message);
15588  }
15589  break; }
15590  case UA_CHUNKTYPE_ABORT:
15591  UA_SecureChannel_removeChunk(channel, sequenceHeader.requestId);
15592  break;
15593  default:
15595  }
15596 
15597  /* Jump to the end of the chunk */
15598  offset += (header.messageHeader.messageSize - processed_header);
15599  } while(chunks->length > offset);
15600 
15601  return retval;
15602 }
15603 
15604 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_session.c" ***********************************/
15605 
15606 /* This Source Code Form is subject to the terms of the Mozilla Public
15607 * License, v. 2.0. If a copy of the MPL was not distributed with this
15608 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
15609 
15610 #ifdef UA_ENABLE_SUBSCRIPTIONS
15611 #endif
15612 
15613 UA_Session adminSession = {
15614  .clientDescription = {.applicationUri = {0, NULL}, .productUri = {0, NULL},
15615  .applicationName = {.locale = {0, NULL}, .text = {0, NULL}},
15616  .applicationType = UA_APPLICATIONTYPE_CLIENT,
15617  .gatewayServerUri = {0, NULL}, .discoveryProfileUri = {0, NULL},
15618  .discoveryUrlsSize = 0, .discoveryUrls = NULL},
15619  .sessionName = {sizeof("Administrator Session")-1, (UA_Byte*)"Administrator Session"},
15620  .authenticationToken = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15621  .identifier.numeric = 1},
15622  .sessionId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 1},
15623  .maxRequestMessageSize = UA_UINT32_MAX, .maxResponseMessageSize = UA_UINT32_MAX,
15624  .timeout = (UA_Double)UA_INT64_MAX, .validTill = UA_INT64_MAX, .channel = NULL,
15625  .continuationPoints = {NULL}};
15626 
15627 void UA_Session_init(UA_Session *session) {
15628  UA_ApplicationDescription_init(&session->clientDescription);
15629  session->activated = false;
15630  UA_NodeId_init(&session->authenticationToken);
15631  UA_NodeId_init(&session->sessionId);
15632  UA_String_init(&session->sessionName);
15633  session->maxRequestMessageSize = 0;
15634  session->maxResponseMessageSize = 0;
15635  session->timeout = 0;
15636  UA_DateTime_init(&session->validTill);
15637  session->channel = NULL;
15639  LIST_INIT(&session->continuationPoints);
15640 #ifdef UA_ENABLE_SUBSCRIPTIONS
15641  LIST_INIT(&session->serverSubscriptions);
15642  session->lastSubscriptionID = 0;
15643  SIMPLEQ_INIT(&session->responseQueue);
15644 #endif
15645 }
15646 
15647 void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server* server) {
15648  UA_ApplicationDescription_deleteMembers(&session->clientDescription);
15649  UA_NodeId_deleteMembers(&session->authenticationToken);
15650  UA_NodeId_deleteMembers(&session->sessionId);
15651  UA_String_deleteMembers(&session->sessionName);
15652  struct ContinuationPointEntry *cp, *temp;
15653  LIST_FOREACH_SAFE(cp, &session->continuationPoints, pointers, temp) {
15654  LIST_REMOVE(cp, pointers);
15655  UA_ByteString_deleteMembers(&cp->identifier);
15656  UA_BrowseDescription_deleteMembers(&cp->browseDescription);
15657  UA_free(cp);
15658  }
15659  if(session->channel)
15660  UA_SecureChannel_detachSession(session->channel, session);
15661 #ifdef UA_ENABLE_SUBSCRIPTIONS
15662  UA_Subscription *currents, *temps;
15663  LIST_FOREACH_SAFE(currents, &session->serverSubscriptions, listEntry, temps) {
15664  LIST_REMOVE(currents, listEntry);
15665  UA_Subscription_deleteMembers(currents, server);
15666  UA_free(currents);
15667  }
15668  UA_PublishResponseEntry *entry;
15669  while((entry = SIMPLEQ_FIRST(&session->responseQueue))) {
15670  SIMPLEQ_REMOVE_HEAD(&session->responseQueue, listEntry);
15671  UA_PublishResponse_deleteMembers(&entry->response);
15672  UA_free(entry);
15673  }
15674 #endif
15675 }
15676 
15677 void UA_Session_updateLifetime(UA_Session *session) {
15678  session->validTill = UA_DateTime_nowMonotonic() +
15679  (UA_DateTime)(session->timeout * UA_MSEC_TO_DATETIME);
15680 }
15681 
15682 #ifdef UA_ENABLE_SUBSCRIPTIONS
15683 
15684 void UA_Session_addSubscription(UA_Session *session, UA_Subscription *newSubscription) {
15685  LIST_INSERT_HEAD(&session->serverSubscriptions, newSubscription, listEntry);
15686 }
15687 
15689 UA_Session_deleteSubscription(UA_Server *server, UA_Session *session,
15690  UA_UInt32 subscriptionID) {
15691  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, subscriptionID);
15692  if(!sub)
15694  LIST_REMOVE(sub, listEntry);
15695  UA_Subscription_deleteMembers(sub, server);
15696  UA_free(sub);
15697  return UA_STATUSCODE_GOOD;
15698 }
15699 
15701 UA_Session_getSubscriptionByID(UA_Session *session, UA_UInt32 subscriptionID) {
15702  UA_Subscription *sub;
15703  LIST_FOREACH(sub, &session->serverSubscriptions, listEntry) {
15704  if(sub->subscriptionID == subscriptionID)
15705  break;
15706  }
15707  return sub;
15708 }
15709 
15710 UA_UInt32 UA_Session_getUniqueSubscriptionID(UA_Session *session) {
15711  return ++(session->lastSubscriptionID);
15712 }
15713 
15714 #endif
15715 
15716 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server.c" ***********************************/
15717 
15718 /* This Source Code Form is subject to the terms of the Mozilla Public
15719 * License, v. 2.0. If a copy of the MPL was not distributed with this
15720 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
15721 
15722 
15723 #ifdef UA_ENABLE_GENERATE_NAMESPACE0
15724 #endif
15725 
15726 #ifdef UA_ENABLE_SUBSCRIPTIONS
15727 #endif
15728 
15729 #if defined(UA_ENABLE_MULTITHREADING) && !defined(NDEBUG)
15730 UA_THREAD_LOCAL bool rcu_locked = false;
15731 #endif
15732 
15733 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
15734 UA_THREAD_LOCAL UA_Session* methodCallSession = NULL;
15735 #endif
15736 
15737 static const UA_NodeId nodeIdHasSubType = {
15738  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15739  .identifier.numeric = UA_NS0ID_HASSUBTYPE};
15740 static const UA_NodeId nodeIdHasComponent = {
15741  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15742  .identifier.numeric = UA_NS0ID_HASCOMPONENT};
15743 static const UA_NodeId nodeIdHasProperty = {
15744  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15745  .identifier.numeric = UA_NS0ID_HASPROPERTY};
15746 static const UA_NodeId nodeIdOrganizes = {
15747  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15748  .identifier.numeric = UA_NS0ID_ORGANIZES};
15749 
15750 #ifndef UA_ENABLE_GENERATE_NAMESPACE0
15751 static const UA_NodeId nodeIdNonHierarchicalReferences = {
15752  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15753  .identifier.numeric = UA_NS0ID_NONHIERARCHICALREFERENCES};
15754 #endif
15755 
15756 /**********************/
15757 /* Namespace Handling */
15758 /**********************/
15759 
15760 UA_UInt16 addNamespace(UA_Server *server, const UA_String name) {
15761  /* Check if the namespace already exists in the server's namespace array */
15762  for(UA_UInt16 i=0;i<server->namespacesSize;++i) {
15763  if(UA_String_equal(&name, &server->namespaces[i]))
15764  return i;
15765  }
15766 
15767  /* Add a new namespace to the namsepace array */
15768  UA_String *newNS = UA_realloc(server->namespaces,
15769  sizeof(UA_String) * (server->namespacesSize + 1));
15770  if(!newNS)
15771  return 0;
15772  server->namespaces = newNS;
15773  UA_StatusCode retval = UA_String_copy(&name, &server->namespaces[server->namespacesSize]);
15774  if(retval != UA_STATUSCODE_GOOD)
15775  return 0;
15776  ++server->namespacesSize;
15777  return (UA_UInt16)(server->namespacesSize - 1);
15778 }
15779 
15780 UA_UInt16 UA_Server_addNamespace(UA_Server *server, const char* name) {
15781  /* Override const attribute to get string (dirty hack) */
15782  const UA_String nameString = {.length = strlen(name),
15783  .data = (UA_Byte*)(uintptr_t)name};
15784  return addNamespace(server, nameString);
15785 }
15786 
15787 
15789 UA_Server_forEachChildNodeCall(UA_Server *server, UA_NodeId parentNodeId,
15790  UA_NodeIteratorCallback callback, void *handle) {
15791  UA_RCU_LOCK();
15792  const UA_Node *parent = UA_NodeStore_get(server->nodestore, &parentNodeId);
15793  if(!parent) {
15794  UA_RCU_UNLOCK();
15796  }
15797 
15798  /* TODO: We need to do an ugly copy of the references array since users may
15799  * delete references from within the callback. In single-threaded mode this
15800  * changes the same node we point at here. In multi-threaded mode, this
15801  * creates a new copy as nodes are truly immutable. */
15802  UA_ReferenceNode *refs = NULL;
15803  size_t refssize = parent->referencesSize;
15804  UA_StatusCode retval = UA_Array_copy(parent->references, parent->referencesSize,
15805  (void**)&refs, &UA_TYPES[UA_TYPES_REFERENCENODE]);
15806  if(retval != UA_STATUSCODE_GOOD) {
15807  UA_RCU_UNLOCK();
15808  return retval;
15809  }
15810 
15811  for(size_t i = parent->referencesSize; i > 0; --i) {
15812  UA_ReferenceNode *ref = &refs[i-1];
15813  retval |= callback(ref->targetId.nodeId, ref->isInverse,
15814  ref->referenceTypeId, handle);
15815  }
15816  UA_RCU_UNLOCK();
15817 
15818  UA_Array_delete(refs, refssize, &UA_TYPES[UA_TYPES_REFERENCENODE]);
15819  return retval;
15820 }
15821 
15822 static UA_AddNodesResult
15823 addNodeInternal(UA_Server *server, UA_Node *node, const UA_NodeId parentNodeId,
15824  const UA_NodeId referenceTypeId) {
15825  UA_AddNodesResult res;
15826  UA_AddNodesResult_init(&res);
15827  UA_RCU_LOCK();
15828  res.statusCode = Service_AddNodes_existing(server, &adminSession, node, &parentNodeId,
15829  &referenceTypeId, &UA_NODEID_NULL,
15830  NULL, &res.addedNodeId);
15831  UA_RCU_UNLOCK();
15832  return res;
15833 }
15834 
15835 static UA_AddNodesResult
15836 addNodeInternalWithType(UA_Server *server, UA_Node *node, const UA_NodeId parentNodeId,
15837  const UA_NodeId referenceTypeId, const UA_NodeId typeIdentifier) {
15838  UA_AddNodesResult res;
15839  UA_AddNodesResult_init(&res);
15840  UA_RCU_LOCK();
15841  res.statusCode = Service_AddNodes_existing(server, &adminSession, node, &parentNodeId,
15842  &referenceTypeId, &typeIdentifier,
15843  NULL, &res.addedNodeId);
15844  UA_RCU_UNLOCK();
15845  return res;
15846 }
15847 
15848 // delete any children of an instance without touching the object itself
15849 static void
15850 deleteInstanceChildren(UA_Server *server, UA_NodeId *objectNodeId) {
15851  /* Browse for children */
15852  UA_BrowseDescription bDes;
15853  UA_BrowseDescription_init(&bDes);
15854  bDes.nodeId = *objectNodeId;
15858  UA_BrowseResult bRes = UA_Server_browse(server, 0, &bDes);
15859 
15860  /* Delete Children */
15861  for(size_t i=0; i<bRes.referencesSize; ++i) {
15862  UA_ReferenceDescription *rd = &bRes.references[i];
15864  UA_Server_deleteNode(server, rd->nodeId.nodeId, true);
15865  } else if (rd->nodeClass == UA_NODECLASS_METHOD) {
15866  UA_Server_deleteReference(server, *objectNodeId, rd->referenceTypeId,
15867  true, rd->nodeId, true);
15868  }
15869  }
15870 
15871  UA_BrowseResult_deleteMembers(&bRes);
15872 }
15873 
15874 /**********/
15875 /* Server */
15876 /**********/
15877 
15878 /* The server needs to be stopped before it can be deleted */
15879 void UA_Server_delete(UA_Server *server) {
15880  // Delete the timed work
15882 
15883  // Delete all internal data
15886  UA_RCU_LOCK();
15887  UA_NodeStore_delete(server->nodestore);
15888  UA_RCU_UNLOCK();
15889  UA_Array_delete(server->namespaces, server->namespacesSize, &UA_TYPES[UA_TYPES_STRING]);
15891  &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
15892 
15893 #ifdef UA_ENABLE_MULTITHREADING
15894  pthread_cond_destroy(&server->dispatchQueue_condition);
15895  pthread_mutex_destroy(&server->dispatchQueue_mutex);
15896 #endif
15897  UA_free(server);
15898 }
15899 
15900 /* Recurring cleanup. Removing unused and timed-out channels and sessions */
15901 static void UA_Server_cleanup(UA_Server *server, void *_) {
15902  UA_DateTime nowMonotonic = UA_DateTime_nowMonotonic();
15903  UA_SessionManager_cleanupTimedOut(&server->sessionManager, nowMonotonic);
15905 }
15906 
15907 static UA_StatusCode
15908 readStatus(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimeStamp,
15909  const UA_NumericRange *range, UA_DataValue *value) {
15910  if(range) {
15911  value->hasStatus = true;
15913  return UA_STATUSCODE_GOOD;
15914  }
15915 
15916  UA_Server *server = (UA_Server*)handle;
15917  UA_ServerStatusDataType *retval = UA_ServerStatusDataType_new();
15918  retval->startTime = server->startTime;
15919  retval->currentTime = UA_DateTime_now();
15920  retval->state = UA_SERVERSTATE_RUNNING;
15921  retval->secondsTillShutdown = 0;
15922  UA_BuildInfo_copy(&server->config.buildInfo, &retval->buildInfo);
15923 
15924  value->value.type = &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE];
15925  value->value.arrayLength = 0;
15926  value->value.data = retval;
15927  value->value.arrayDimensionsSize = 0;
15928  value->value.arrayDimensions = NULL;
15929  value->hasValue = true;
15930  if(sourceTimeStamp) {
15931  value->hasSourceTimestamp = true;
15932  value->sourceTimestamp = UA_DateTime_now();
15933  }
15934  return UA_STATUSCODE_GOOD;
15935 }
15936 
15938 static UA_StatusCode
15939 readServiceLevel(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimeStamp,
15940  const UA_NumericRange *range, UA_DataValue *value) {
15941  if(range) {
15942  value->hasStatus = true;
15944  return UA_STATUSCODE_GOOD;
15945  }
15946 
15947  value->value.type = &UA_TYPES[UA_TYPES_BYTE];
15948  value->value.arrayLength = 0;
15949  UA_Byte *byte = UA_Byte_new();
15950  *byte = 255;
15951  value->value.data = byte;
15952  value->value.arrayDimensionsSize = 0;
15953  value->value.arrayDimensions = NULL;
15954  value->hasValue = true;
15955  if(sourceTimeStamp) {
15956  value->hasSourceTimestamp = true;
15957  value->sourceTimestamp = UA_DateTime_now();
15958  }
15959  return UA_STATUSCODE_GOOD;
15960 }
15961 
15963 static UA_StatusCode
15964 readAuditing(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimeStamp,
15965  const UA_NumericRange *range, UA_DataValue *value) {
15966  if(range) {
15967  value->hasStatus = true;
15969  return UA_STATUSCODE_GOOD;
15970  }
15971 
15972  value->value.type = &UA_TYPES[UA_TYPES_BOOLEAN];
15973  value->value.arrayLength = 0;
15974  UA_Boolean *boolean = UA_Boolean_new();
15975  *boolean = false;
15976  value->value.data = boolean;
15977  value->value.arrayDimensionsSize = 0;
15978  value->value.arrayDimensions = NULL;
15979  value->hasValue = true;
15980  if(sourceTimeStamp) {
15981  value->hasSourceTimestamp = true;
15982  value->sourceTimestamp = UA_DateTime_now();
15983  }
15984  return UA_STATUSCODE_GOOD;
15985 }
15986 
15987 static UA_StatusCode
15988 readNamespaces(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimestamp,
15989  const UA_NumericRange *range, UA_DataValue *value) {
15990  if(range) {
15991  value->hasStatus = true;
15993  return UA_STATUSCODE_GOOD;
15994  }
15995  UA_Server *server = (UA_Server*)handle;
15996  UA_StatusCode retval;
15997  retval = UA_Variant_setArrayCopy(&value->value, server->namespaces,
15998  server->namespacesSize, &UA_TYPES[UA_TYPES_STRING]);
15999  if(retval != UA_STATUSCODE_GOOD)
16000  return retval;
16001  value->hasValue = true;
16002  if(sourceTimestamp) {
16003  value->hasSourceTimestamp = true;
16004  value->sourceTimestamp = UA_DateTime_now();
16005  }
16006  return UA_STATUSCODE_GOOD;
16007 }
16008 
16009 static UA_StatusCode
16010 writeNamespaces(void *handle, const UA_NodeId nodeid, const UA_Variant *data,
16011  const UA_NumericRange *range) {
16012  UA_Server *server = (UA_Server*)handle;
16013 
16014  /* Check the data type */
16015  if(data->type != &UA_TYPES[UA_TYPES_STRING])
16017 
16018  /* Check that the variant is not empty */
16019  if(!data->data)
16021 
16022  /* TODO: Writing with a range is not implemented */
16023  if(range)
16025 
16026  UA_String *newNamespaces = data->data;
16027  size_t newNamespacesSize = data->arrayLength;
16028 
16029  /* Test if we append to the existing namespaces */
16030  if(newNamespacesSize <= server->namespacesSize)
16032 
16033  /* Test if the existing namespaces are unchanged */
16034  for(size_t i = 0; i < server->namespacesSize; ++i) {
16035  if(!UA_String_equal(&server->namespaces[i], &newNamespaces[i]))
16037  }
16038 
16039  /* Add namespaces */
16040  for(size_t i = server->namespacesSize; i < newNamespacesSize; ++i)
16041  addNamespace(server, newNamespaces[i]);
16042  return UA_STATUSCODE_GOOD;
16043 }
16044 
16045 static UA_StatusCode
16046 readCurrentTime(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimeStamp,
16047  const UA_NumericRange *range, UA_DataValue *value) {
16048  if(range) {
16049  value->hasStatus = true;
16051  return UA_STATUSCODE_GOOD;
16052  }
16053  UA_DateTime currentTime = UA_DateTime_now();
16054  UA_StatusCode retval = UA_Variant_setScalarCopy(&value->value, &currentTime,
16055  &UA_TYPES[UA_TYPES_DATETIME]);
16056  if(retval != UA_STATUSCODE_GOOD)
16057  return retval;
16058  value->hasValue = true;
16059  if(sourceTimeStamp) {
16060  value->hasSourceTimestamp = true;
16061  value->sourceTimestamp = currentTime;
16062  }
16063  return UA_STATUSCODE_GOOD;
16064 }
16065 
16066 static void copyNames(UA_Node *node, char *name) {
16067  node->browseName = UA_QUALIFIEDNAME_ALLOC(0, name);
16068  node->displayName = UA_LOCALIZEDTEXT_ALLOC("en_US", name);
16069  node->description = UA_LOCALIZEDTEXT_ALLOC("en_US", name);
16070 }
16071 
16072 static void
16073 addDataTypeNode(UA_Server *server, char* name, UA_UInt32 datatypeid,
16074  UA_Boolean isAbstract, UA_UInt32 parent) {
16076  copyNames((UA_Node*)datatype, name);
16077  datatype->nodeId.identifier.numeric = datatypeid;
16078  datatype->isAbstract = isAbstract;
16079  addNodeInternal(server, (UA_Node*)datatype,
16080  UA_NODEID_NUMERIC(0, parent), nodeIdHasSubType);
16081 }
16082 
16083 static void
16084 addObjectTypeNode(UA_Server *server, char* name, UA_UInt32 objecttypeid,
16085  UA_UInt32 parent, UA_UInt32 parentreference) {
16087  copyNames((UA_Node*)objecttype, name);
16088  objecttype->nodeId.identifier.numeric = objecttypeid;
16089  addNodeInternal(server, (UA_Node*)objecttype, UA_NODEID_NUMERIC(0, parent),
16090  UA_NODEID_NUMERIC(0, parentreference));
16091 }
16092 
16093 static UA_VariableTypeNode*
16094 createVariableTypeNode(UA_Server *server, char* name, UA_UInt32 variabletypeid,
16095  UA_Boolean abstract) {
16097  copyNames((UA_Node*)variabletype, name);
16098  variabletype->nodeId.identifier.numeric = variabletypeid;
16099  variabletype->isAbstract = abstract;
16100  return variabletype;
16101 }
16102 
16103 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
16104 static UA_StatusCode
16105 GetMonitoredItems(void *handle, const UA_NodeId objectId, size_t inputSize,
16106  const UA_Variant *input, size_t outputSize, UA_Variant *output) {
16107  UA_UInt32 subscriptionId = *((UA_UInt32*)(input[0].data));
16108  UA_Session* session = methodCallSession;
16109  UA_Subscription* subscription = UA_Session_getSubscriptionByID(session, subscriptionId);
16110  if(!subscription)
16112 
16113  UA_UInt32 sizeOfOutput = 0;
16114  UA_MonitoredItem* monitoredItem;
16115  LIST_FOREACH(monitoredItem, &subscription->monitoredItems, listEntry) {
16116  ++sizeOfOutput;
16117  }
16118  if(sizeOfOutput==0)
16119  return UA_STATUSCODE_GOOD;
16120 
16121  UA_UInt32* clientHandles = UA_Array_new(sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
16122  UA_UInt32* serverHandles = UA_Array_new(sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
16123  UA_UInt32 i = 0;
16124  LIST_FOREACH(monitoredItem, &subscription->monitoredItems, listEntry) {
16125  clientHandles[i] = monitoredItem->clientHandle;
16126  serverHandles[i] = monitoredItem->itemId;
16127  ++i;
16128  }
16129  UA_Variant_setArray(&output[0], clientHandles, sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
16130  UA_Variant_setArray(&output[1], serverHandles, sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
16131  return UA_STATUSCODE_GOOD;
16132 }
16133 #endif
16134 
16135 UA_Server * UA_Server_new(const UA_ServerConfig config) {
16136  UA_Server *server = UA_calloc(1, sizeof(UA_Server));
16137  if(!server)
16138  return NULL;
16139 
16140  server->config = config;
16141  server->nodestore = UA_NodeStore_new();
16142  LIST_INIT(&server->repeatedJobs);
16143 
16144 #ifdef UA_ENABLE_MULTITHREADING
16145  rcu_init();
16146  cds_wfcq_init(&server->dispatchQueue_head, &server->dispatchQueue_tail);
16147  cds_lfs_init(&server->mainLoopJobs);
16148 #else
16149  SLIST_INIT(&server->delayedCallbacks);
16150 #endif
16151 
16152 #ifndef UA_ENABLE_DETERMINISTIC_RNG
16154 #endif
16155 
16156  /* ns0 and ns1 */
16157  server->namespaces = UA_Array_new(2, &UA_TYPES[UA_TYPES_STRING]);
16158  server->namespaces[0] = UA_STRING_ALLOC("http://opcfoundation.org/UA/");
16159  UA_String_copy(&server->config.applicationDescription.applicationUri, &server->namespaces[1]);
16160  server->namespacesSize = 2;
16161 
16162  /* Create endpoints w/o endpointurl. It is added from the networklayers at startup */
16163  server->endpointDescriptions = UA_Array_new(server->config.networkLayersSize,
16164  &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
16165  server->endpointDescriptionsSize = server->config.networkLayersSize;
16166  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
16167  UA_EndpointDescription *endpoint = &server->endpointDescriptions[i];
16169  endpoint->securityPolicyUri =
16170  UA_STRING_ALLOC("http://opcfoundation.org/UA/SecurityPolicy#None");
16171  endpoint->transportProfileUri =
16172  UA_STRING_ALLOC("http://opcfoundation.org/UA-Profile/Transport/uatcp-uasc-uabinary");
16173 
16174  size_t policies = 0;
16175  if(server->config.enableAnonymousLogin)
16176  ++policies;
16177  if(server->config.enableUsernamePasswordLogin)
16178  ++policies;
16179  endpoint->userIdentityTokensSize = policies;
16180  endpoint->userIdentityTokens = UA_Array_new(policies, &UA_TYPES[UA_TYPES_USERTOKENPOLICY]);
16181 
16182  size_t currentIndex = 0;
16183  if(server->config.enableAnonymousLogin) {
16184  UA_UserTokenPolicy_init(&endpoint->userIdentityTokens[currentIndex]);
16185  endpoint->userIdentityTokens[currentIndex].tokenType = UA_USERTOKENTYPE_ANONYMOUS;
16186  endpoint->userIdentityTokens[currentIndex].policyId = UA_STRING_ALLOC(ANONYMOUS_POLICY);
16187  ++currentIndex;
16188  }
16189  if(server->config.enableUsernamePasswordLogin) {
16190  UA_UserTokenPolicy_init(&endpoint->userIdentityTokens[currentIndex]);
16191  endpoint->userIdentityTokens[currentIndex].tokenType = UA_USERTOKENTYPE_USERNAME;
16192  endpoint->userIdentityTokens[currentIndex].policyId = UA_STRING_ALLOC(USERNAME_POLICY);
16193  }
16194 
16195  /* The standard says "the HostName specified in the Server Certificate is the
16196  same as the HostName contained in the endpointUrl provided in the
16197  EndpointDescription */
16198  UA_String_copy(&server->config.serverCertificate, &endpoint->serverCertificate);
16199  UA_ApplicationDescription_copy(&server->config.applicationDescription, &endpoint->server);
16200 
16201  /* copy the discovery url only once the networlayer has been started */
16202  // UA_String_copy(&server->config.networkLayers[i].discoveryUrl, &endpoint->endpointUrl);
16203  }
16204 
16206  UA_SessionManager_init(&server->sessionManager, server);
16207 
16208  UA_Job cleanup = {.type = UA_JOBTYPE_METHODCALL,
16209  .job.methodCall = {.method = UA_Server_cleanup, .data = NULL} };
16210  UA_Server_addRepeatedJob(server, cleanup, 10000, NULL);
16211 
16212  server->startTime = UA_DateTime_now();
16213 
16214 #ifndef UA_ENABLE_GENERATE_NAMESPACE0
16215 
16216  /*********************************/
16217  /* Bootstrap reference hierarchy */
16218  /*********************************/
16219 
16221  copyNames((UA_Node*)references, "References");
16222  references->nodeId.identifier.numeric = UA_NS0ID_REFERENCES;
16223  references->isAbstract = true;
16224  references->symmetric = true;
16225  references->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "References");
16226 
16228  copyNames((UA_Node*)hassubtype, "HasSubtype");
16229  hassubtype->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "HasSupertype");
16230  hassubtype->nodeId.identifier.numeric = UA_NS0ID_HASSUBTYPE;
16231  hassubtype->isAbstract = false;
16232  hassubtype->symmetric = false;
16233 
16234  UA_RCU_LOCK();
16235  UA_NodeStore_insert(server->nodestore, (UA_Node*)references);
16236  UA_NodeStore_insert(server->nodestore, (UA_Node*)hassubtype);
16237  UA_RCU_UNLOCK();
16238 
16239  UA_ReferenceTypeNode *hierarchicalreferences = UA_NodeStore_newReferenceTypeNode();
16240  copyNames((UA_Node*)hierarchicalreferences, "HierarchicalReferences");
16241  hierarchicalreferences->nodeId.identifier.numeric = UA_NS0ID_HIERARCHICALREFERENCES;
16242  hierarchicalreferences->isAbstract = true;
16243  hierarchicalreferences->symmetric = false;
16244  addNodeInternal(server, (UA_Node*)hierarchicalreferences,
16245  UA_NODEID_NUMERIC(0, UA_NS0ID_REFERENCES), nodeIdHasSubType);
16246 
16247  UA_ReferenceTypeNode *nonhierarchicalreferences = UA_NodeStore_newReferenceTypeNode();
16248  copyNames((UA_Node*)nonhierarchicalreferences, "NonHierarchicalReferences");
16249  nonhierarchicalreferences->nodeId.identifier.numeric = UA_NS0ID_NONHIERARCHICALREFERENCES;
16250  nonhierarchicalreferences->isAbstract = true;
16251  nonhierarchicalreferences->symmetric = false;
16252  addNodeInternal(server, (UA_Node*)nonhierarchicalreferences,
16253  UA_NODEID_NUMERIC(0, UA_NS0ID_REFERENCES), nodeIdHasSubType);
16254 
16256  copyNames((UA_Node*)haschild, "HasChild");
16257  haschild->nodeId.identifier.numeric = UA_NS0ID_HASCHILD;
16258  haschild->isAbstract = false;
16259  haschild->symmetric = false;
16260  addNodeInternal(server, (UA_Node*)haschild,
16261  UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES), nodeIdHasSubType);
16262 
16264  copyNames((UA_Node*)organizes, "Organizes");
16265  organizes->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "OrganizedBy");
16266  organizes->nodeId.identifier.numeric = UA_NS0ID_ORGANIZES;
16267  organizes->isAbstract = false;
16268  organizes->symmetric = false;
16269  addNodeInternal(server, (UA_Node*)organizes,
16270  UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES), nodeIdHasSubType);
16271 
16273  copyNames((UA_Node*)haseventsource, "HasEventSource");
16274  haseventsource->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "EventSourceOf");
16275  haseventsource->nodeId.identifier.numeric = UA_NS0ID_HASEVENTSOURCE;
16276  haseventsource->isAbstract = false;
16277  haseventsource->symmetric = false;
16278  addNodeInternal(server, (UA_Node*)haseventsource,
16279  UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES), nodeIdHasSubType);
16280 
16282  copyNames((UA_Node*)hasmodellingrule, "HasModellingRule");
16283  hasmodellingrule->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "ModellingRuleOf");
16284  hasmodellingrule->nodeId.identifier.numeric = UA_NS0ID_HASMODELLINGRULE;
16285  hasmodellingrule->isAbstract = false;
16286  hasmodellingrule->symmetric = false;
16287  addNodeInternal(server, (UA_Node*)hasmodellingrule, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16288 
16290  copyNames((UA_Node*)hasencoding, "HasEncoding");
16291  hasencoding->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "EncodingOf");
16292  hasencoding->nodeId.identifier.numeric = UA_NS0ID_HASENCODING;
16293  hasencoding->isAbstract = false;
16294  hasencoding->symmetric = false;
16295  addNodeInternal(server, (UA_Node*)hasencoding, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16296 
16298  copyNames((UA_Node*)hasdescription, "HasDescription");
16299  hasdescription->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "DescriptionOf");
16300  hasdescription->nodeId.identifier.numeric = UA_NS0ID_HASDESCRIPTION;
16301  hasdescription->isAbstract = false;
16302  hasdescription->symmetric = false;
16303  addNodeInternal(server, (UA_Node*)hasdescription, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16304 
16306  copyNames((UA_Node*)hastypedefinition, "HasTypeDefinition");
16307  hastypedefinition->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "TypeDefinitionOf");
16308  hastypedefinition->nodeId.identifier.numeric = UA_NS0ID_HASTYPEDEFINITION;
16309  hastypedefinition->isAbstract = false;
16310  hastypedefinition->symmetric = false;
16311  addNodeInternal(server, (UA_Node*)hastypedefinition, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16312 
16314  copyNames((UA_Node*)generatesevent, "GeneratesEvent");
16315  generatesevent->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "GeneratedBy");
16316  generatesevent->nodeId.identifier.numeric = UA_NS0ID_GENERATESEVENT;
16317  generatesevent->isAbstract = false;
16318  generatesevent->symmetric = false;
16319  addNodeInternal(server, (UA_Node*)generatesevent, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16320 
16322  copyNames((UA_Node*)aggregates, "Aggregates");
16323  aggregates->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "AggregatedBy");
16324  aggregates->nodeId.identifier.numeric = UA_NS0ID_AGGREGATES;
16325  aggregates->isAbstract = false;
16326  aggregates->symmetric = false;
16327  addNodeInternal(server, (UA_Node*)aggregates, UA_NODEID_NUMERIC(0, UA_NS0ID_HASCHILD), nodeIdHasSubType);
16328 
16329  /* complete bootstrap of hassubtype */
16330  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_HASCHILD), nodeIdHasSubType,
16331  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE), true);
16332 
16334  copyNames((UA_Node*)hasproperty, "HasProperty");
16335  hasproperty->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "PropertyOf");
16336  hasproperty->nodeId.identifier.numeric = UA_NS0ID_HASPROPERTY;
16337  hasproperty->isAbstract = false;
16338  hasproperty->symmetric = false;
16339  addNodeInternal(server, (UA_Node*)hasproperty,
16340  UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES), nodeIdHasSubType);
16341 
16343  copyNames((UA_Node*)hascomponent, "HasComponent");
16344  hascomponent->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "ComponentOf");
16345  hascomponent->nodeId.identifier.numeric = UA_NS0ID_HASCOMPONENT;
16346  hascomponent->isAbstract = false;
16347  hascomponent->symmetric = false;
16348  addNodeInternal(server, (UA_Node*)hascomponent, UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES), nodeIdHasSubType);
16349 
16351  copyNames((UA_Node*)hasnotifier, "HasNotifier");
16352  hasnotifier->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "NotifierOf");
16353  hasnotifier->nodeId.identifier.numeric = UA_NS0ID_HASNOTIFIER;
16354  hasnotifier->isAbstract = false;
16355  hasnotifier->symmetric = false;
16356  addNodeInternal(server, (UA_Node*)hasnotifier, UA_NODEID_NUMERIC(0, UA_NS0ID_HASEVENTSOURCE), nodeIdHasSubType);
16357 
16359  copyNames((UA_Node*)hasorderedcomponent, "HasOrderedComponent");
16360  hasorderedcomponent->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "OrderedComponentOf");
16361  hasorderedcomponent->nodeId.identifier.numeric = UA_NS0ID_HASORDEREDCOMPONENT;
16362  hasorderedcomponent->isAbstract = false;
16363  hasorderedcomponent->symmetric = false;
16364  addNodeInternal(server, (UA_Node*)hasorderedcomponent, UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT), nodeIdHasSubType);
16365 
16367  copyNames((UA_Node*)hasmodelparent, "HasModelParent");
16368  hasmodelparent->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "ModelParentOf");
16369  hasmodelparent->nodeId.identifier.numeric = UA_NS0ID_HASMODELPARENT;
16370  hasmodelparent->isAbstract = false;
16371  hasmodelparent->symmetric = false;
16372  addNodeInternal(server, (UA_Node*)hasmodelparent, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16373 
16375  copyNames((UA_Node*)fromstate, "FromState");
16376  fromstate->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "ToTransition");
16377  fromstate->nodeId.identifier.numeric = UA_NS0ID_FROMSTATE;
16378  fromstate->isAbstract = false;
16379  fromstate->symmetric = false;
16380  addNodeInternal(server, (UA_Node*)fromstate, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16381 
16383  copyNames((UA_Node*)tostate, "ToState");
16384  tostate->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "FromTransition");
16385  tostate->nodeId.identifier.numeric = UA_NS0ID_TOSTATE;
16386  tostate->isAbstract = false;
16387  tostate->symmetric = false;
16388  addNodeInternal(server, (UA_Node*)tostate, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16389 
16391  copyNames((UA_Node*)hascause, "HasCause");
16392  hascause->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "MayBeCausedBy");
16393  hascause->nodeId.identifier.numeric = UA_NS0ID_HASCAUSE;
16394  hascause->isAbstract = false;
16395  hascause->symmetric = false;
16396  addNodeInternal(server, (UA_Node*)hascause, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16397 
16399  copyNames((UA_Node*)haseffect, "HasEffect");
16400  haseffect->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "MayBeEffectedBy");
16401  haseffect->nodeId.identifier.numeric = UA_NS0ID_HASEFFECT;
16402  haseffect->isAbstract = false;
16403  haseffect->symmetric = false;
16404  addNodeInternal(server, (UA_Node*)haseffect, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16405 
16406  UA_ReferenceTypeNode *hashistoricalconfiguration = UA_NodeStore_newReferenceTypeNode();
16407  copyNames((UA_Node*)hashistoricalconfiguration, "HasHistoricalConfiguration");
16408  hashistoricalconfiguration->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "HistoricalConfigurationOf");
16409  hashistoricalconfiguration->nodeId.identifier.numeric = UA_NS0ID_HASHISTORICALCONFIGURATION;
16410  hashistoricalconfiguration->isAbstract = false;
16411  hashistoricalconfiguration->symmetric = false;
16412  addNodeInternal(server, (UA_Node*)hashistoricalconfiguration, UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES), nodeIdHasSubType);
16413 
16414  /**************/
16415  /* Data Types */
16416  /**************/
16417 
16419  copyNames((UA_Node*)basedatatype, "BaseDataType");
16420  basedatatype->nodeId.identifier.numeric = UA_NS0ID_BASEDATATYPE;
16421  basedatatype->isAbstract = true;
16422  UA_RCU_LOCK();
16423  UA_NodeStore_insert(server->nodestore, (UA_Node*)basedatatype);
16424  UA_RCU_UNLOCK();
16425 
16426  addDataTypeNode(server, "Boolean", UA_NS0ID_BOOLEAN, false, UA_NS0ID_BASEDATATYPE);
16427  addDataTypeNode(server, "Number", UA_NS0ID_NUMBER, true, UA_NS0ID_BASEDATATYPE);
16428  addDataTypeNode(server, "Float", UA_NS0ID_FLOAT, false, UA_NS0ID_NUMBER);
16429  addDataTypeNode(server, "Double", UA_NS0ID_DOUBLE, false, UA_NS0ID_NUMBER);
16430  addDataTypeNode(server, "Integer", UA_NS0ID_INTEGER, true, UA_NS0ID_NUMBER);
16431  addDataTypeNode(server, "SByte", UA_NS0ID_SBYTE, false, UA_NS0ID_INTEGER);
16432  addDataTypeNode(server, "Int16", UA_NS0ID_INT16, false, UA_NS0ID_INTEGER);
16433  addDataTypeNode(server, "Int32", UA_NS0ID_INT32, false, UA_NS0ID_INTEGER);
16434  addDataTypeNode(server, "Int64", UA_NS0ID_INT64, false, UA_NS0ID_INTEGER);
16435  addDataTypeNode(server, "UInteger", UA_NS0ID_UINTEGER, true, UA_NS0ID_INTEGER);
16436  addDataTypeNode(server, "Byte", UA_NS0ID_BYTE, false, UA_NS0ID_UINTEGER);
16437  addDataTypeNode(server, "UInt16", UA_NS0ID_UINT16, false, UA_NS0ID_UINTEGER);
16438  addDataTypeNode(server, "UInt32", UA_NS0ID_UINT32, false, UA_NS0ID_UINTEGER);
16439  addDataTypeNode(server, "UInt64", UA_NS0ID_UINT64, false, UA_NS0ID_UINTEGER);
16440  addDataTypeNode(server, "String", UA_NS0ID_STRING, false, UA_NS0ID_BASEDATATYPE);
16441  addDataTypeNode(server, "DateTime", UA_NS0ID_DATETIME, false, UA_NS0ID_BASEDATATYPE);
16442  addDataTypeNode(server, "Guid", UA_NS0ID_GUID, false, UA_NS0ID_BASEDATATYPE);
16443  addDataTypeNode(server, "ByteString", UA_NS0ID_BYTESTRING, false, UA_NS0ID_BASEDATATYPE);
16444  addDataTypeNode(server, "XmlElement", UA_NS0ID_XMLELEMENT, false, UA_NS0ID_BASEDATATYPE);
16445  addDataTypeNode(server, "NodeId", UA_NS0ID_NODEID, false, UA_NS0ID_BASEDATATYPE);
16446  addDataTypeNode(server, "ExpandedNodeId", UA_NS0ID_EXPANDEDNODEID, false, UA_NS0ID_BASEDATATYPE);
16447  addDataTypeNode(server, "StatusCode", UA_NS0ID_STATUSCODE, false, UA_NS0ID_BASEDATATYPE);
16448  addDataTypeNode(server, "QualifiedName", UA_NS0ID_QUALIFIEDNAME, false, UA_NS0ID_BASEDATATYPE);
16449  addDataTypeNode(server, "LocalizedText", UA_NS0ID_LOCALIZEDTEXT, false, UA_NS0ID_BASEDATATYPE);
16450  addDataTypeNode(server, "Structure", UA_NS0ID_STRUCTURE, true, UA_NS0ID_BASEDATATYPE);
16451  addDataTypeNode(server, "ServerStatusDataType", UA_NS0ID_SERVERSTATUSDATATYPE, false, UA_NS0ID_STRUCTURE);
16452  addDataTypeNode(server, "BuildInfo", UA_NS0ID_BUILDINFO, false, UA_NS0ID_STRUCTURE);
16453  addDataTypeNode(server, "DataValue", UA_NS0ID_DATAVALUE, false, UA_NS0ID_BASEDATATYPE);
16454  addDataTypeNode(server, "DiagnosticInfo", UA_NS0ID_DIAGNOSTICINFO, false, UA_NS0ID_BASEDATATYPE);
16455  addDataTypeNode(server, "Enumeration", UA_NS0ID_ENUMERATION, true, UA_NS0ID_BASEDATATYPE);
16456  addDataTypeNode(server, "ServerState", UA_NS0ID_SERVERSTATE, false, UA_NS0ID_ENUMERATION);
16457 
16458  /*****************/
16459  /* VariableTypes */
16460  /*****************/
16461 
16462  UA_VariableTypeNode *basevartype =
16463  createVariableTypeNode(server, "BaseVariableType", UA_NS0ID_BASEVARIABLETYPE, true);
16464  basevartype->valueRank = -2;
16465  basevartype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE);
16466  UA_RCU_LOCK();
16467  UA_NodeStore_insert(server->nodestore, (UA_Node*)basevartype);
16468  UA_RCU_UNLOCK();
16469 
16470  UA_VariableTypeNode *basedatavartype =
16471  createVariableTypeNode(server, "BaseDataVariableType", UA_NS0ID_BASEDATAVARIABLETYPE, false);
16472  basedatavartype->valueRank = -2;
16473  basedatavartype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE);
16474  addNodeInternalWithType(server, (UA_Node*)basedatavartype,
16475  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE),
16476  nodeIdHasSubType, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE));
16477 
16478  UA_VariableTypeNode *propertytype =
16479  createVariableTypeNode(server, "PropertyType", UA_NS0ID_PROPERTYTYPE, false);
16480  propertytype->valueRank = -2;
16481  propertytype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE);
16482  addNodeInternalWithType(server, (UA_Node*)propertytype,
16483  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE),
16484  nodeIdHasSubType, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE));
16485 
16486  UA_VariableTypeNode *buildinfotype =
16487  createVariableTypeNode(server, "BuildInfoType", UA_NS0ID_BUILDINFOTYPE, false);
16488  buildinfotype->valueRank = -1;
16489  buildinfotype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BUILDINFO);
16490  addNodeInternalWithType(server, (UA_Node*)buildinfotype,
16491  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE),
16492  nodeIdHasSubType, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16493 
16494  UA_VariableTypeNode *serverstatustype =
16495  createVariableTypeNode(server, "ServerStatusType", UA_NS0ID_SERVERSTATUSTYPE, false);
16496  serverstatustype->valueRank = -1;
16497  serverstatustype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERSTATUSDATATYPE);
16498  addNodeInternalWithType(server, (UA_Node*)serverstatustype,
16499  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE),
16500  nodeIdHasSubType, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16501 
16502  /**********************/
16503  /* Basic Object Types */
16504  /**********************/
16505 
16507  copyNames((UA_Node*)baseobjtype, "BaseObjectType");
16508  baseobjtype->nodeId.identifier.numeric = UA_NS0ID_BASEOBJECTTYPE;
16509  UA_RCU_LOCK();
16510  UA_NodeStore_insert(server->nodestore, (UA_Node*)baseobjtype);
16511  UA_RCU_UNLOCK();
16512 
16513  addObjectTypeNode(server, "ModellingRuleType", UA_NS0ID_MODELLINGRULETYPE,
16515  addObjectTypeNode(server, "FolderType", UA_NS0ID_FOLDERTYPE,
16517  addObjectTypeNode(server, "ServerType", UA_NS0ID_SERVERTYPE,
16519  addObjectTypeNode(server, "ServerDiagnosticsType", UA_NS0ID_SERVERDIAGNOSTICSTYPE,
16521  addObjectTypeNode(server, "ServerCapatilitiesType", UA_NS0ID_SERVERCAPABILITIESTYPE,
16523 
16524  /******************/
16525  /* Root and below */
16526  /******************/
16527 
16528  static const UA_NodeId nodeIdFolderType = {
16529  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
16530  .identifier.numeric = UA_NS0ID_FOLDERTYPE};
16531  static const UA_NodeId nodeIdHasTypeDefinition = {
16532  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
16533  .identifier.numeric = UA_NS0ID_HASTYPEDEFINITION};
16534 
16536  copyNames((UA_Node*)root, "Root");
16537  root->nodeId.identifier.numeric = UA_NS0ID_ROOTFOLDER;
16538  UA_RCU_LOCK();
16539  UA_NodeStore_insert(server->nodestore, (UA_Node*)root);
16540  UA_RCU_UNLOCK();
16541  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_ROOTFOLDER), nodeIdHasTypeDefinition,
16542  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE), true);
16543 
16545  copyNames((UA_Node*)objects, "Objects");
16546  objects->nodeId.identifier.numeric = UA_NS0ID_OBJECTSFOLDER;
16547  addNodeInternalWithType(server, (UA_Node*)objects, UA_NODEID_NUMERIC(0, UA_NS0ID_ROOTFOLDER),
16548  nodeIdOrganizes, nodeIdFolderType);
16549 
16551  copyNames((UA_Node*)types, "Types");
16552  types->nodeId.identifier.numeric = UA_NS0ID_TYPESFOLDER;
16553  addNodeInternalWithType(server, (UA_Node*)types, UA_NODEID_NUMERIC(0, UA_NS0ID_ROOTFOLDER),
16554  nodeIdOrganizes, nodeIdFolderType);
16555 
16556  UA_ObjectNode *referencetypes = UA_NodeStore_newObjectNode();
16557  copyNames((UA_Node*)referencetypes, "ReferenceTypes");
16558  referencetypes->nodeId.identifier.numeric = UA_NS0ID_REFERENCETYPESFOLDER;
16559  addNodeInternalWithType(server, (UA_Node*)referencetypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16560  nodeIdOrganizes, nodeIdFolderType);
16561  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_REFERENCETYPESFOLDER), nodeIdOrganizes,
16562  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_REFERENCES), true);
16563 
16565  copyNames((UA_Node*)datatypes, "DataTypes");
16566  datatypes->nodeId.identifier.numeric = UA_NS0ID_DATATYPESFOLDER;
16567  addNodeInternalWithType(server, (UA_Node*)datatypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16568  nodeIdOrganizes, nodeIdFolderType);
16569  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_DATATYPESFOLDER), nodeIdOrganizes,
16570  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE), true);
16571 
16572  UA_ObjectNode *variabletypes = UA_NodeStore_newObjectNode();
16573  copyNames((UA_Node*)variabletypes, "VariableTypes");
16574  variabletypes->nodeId.identifier.numeric = UA_NS0ID_VARIABLETYPESFOLDER;
16575  addNodeInternalWithType(server, (UA_Node*)variabletypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16576  nodeIdOrganizes, nodeIdFolderType);
16577  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_VARIABLETYPESFOLDER), nodeIdOrganizes,
16578  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE), true);
16579 
16580  UA_ObjectNode *objecttypes = UA_NodeStore_newObjectNode();
16581  copyNames((UA_Node*)objecttypes, "ObjectTypes");
16582  objecttypes->nodeId.identifier.numeric = UA_NS0ID_OBJECTTYPESFOLDER;
16583  addNodeInternalWithType(server, (UA_Node*)objecttypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16584  nodeIdOrganizes, nodeIdFolderType);
16585  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTTYPESFOLDER), nodeIdOrganizes,
16586  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE), true);
16587 
16588  UA_ObjectNode *eventtypes = UA_NodeStore_newObjectNode();
16589  copyNames((UA_Node*)eventtypes, "EventTypes");
16590  eventtypes->nodeId.identifier.numeric = UA_NS0ID_EVENTTYPESFOLDER;
16591  addNodeInternalWithType(server, (UA_Node*)eventtypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16592  nodeIdOrganizes, nodeIdFolderType);
16593 
16595  copyNames((UA_Node*)views, "Views");
16596  views->nodeId.identifier.numeric = UA_NS0ID_VIEWSFOLDER;
16597  addNodeInternalWithType(server, (UA_Node*)views, UA_NODEID_NUMERIC(0, UA_NS0ID_ROOTFOLDER),
16598  nodeIdOrganizes, nodeIdFolderType);
16599 
16600  /*******************/
16601  /* Modelling Rules */
16602  /*******************/
16603 
16605  copyNames((UA_Node*)mandatory, "Mandatory");
16606  mandatory->nodeId.identifier.numeric = UA_NS0ID_MODELLINGRULE_MANDATORY;
16607  addNodeInternalWithType(server, (UA_Node*)mandatory, UA_NODEID_NULL,
16608  UA_NODEID_NULL, UA_NODEID_NUMERIC(0, UA_NS0ID_MODELLINGRULETYPE));
16609 
16611  copyNames((UA_Node*)optional, "Optional");
16612  optional->nodeId.identifier.numeric = UA_NS0ID_MODELLINGRULE_OPTIONAL;
16613  addNodeInternalWithType(server, (UA_Node*)optional, UA_NODEID_NULL,
16614  UA_NODEID_NULL, UA_NODEID_NUMERIC(0, UA_NS0ID_MODELLINGRULETYPE));
16615 
16616 #else
16617  /* load the generated namespace externally */
16618  ua_namespaceinit_generated(server);
16619 #endif
16620 
16621  /*********************/
16622  /* The Server Object */
16623  /*********************/
16624 
16625  /* Create our own server object */
16626  UA_ObjectNode *servernode = UA_NodeStore_newObjectNode();
16627  copyNames((UA_Node*)servernode, "Server");
16628  servernode->nodeId.identifier.numeric = UA_NS0ID_SERVER;
16629  addNodeInternalWithType(server, (UA_Node*)servernode, UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER),
16630  nodeIdOrganizes, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERTYPE));
16631 
16632  // If we are in an UA conformant namespace, the above function just created a full ServerType object.
16633  // Before readding every variable, delete whatever got instantiated.
16634  // here we can't reuse servernode->nodeId because it may be deleted in addNodeInternalWithType if the node could not be added
16635  UA_NodeId serverNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER);
16636  deleteInstanceChildren(server, &serverNodeId);
16637 
16638  UA_VariableNode *namespaceArray = UA_NodeStore_newVariableNode();
16639  copyNames((UA_Node*)namespaceArray, "NamespaceArray");
16640  namespaceArray->nodeId.identifier.numeric = UA_NS0ID_SERVER_NAMESPACEARRAY;
16641  namespaceArray->valueSource = UA_VALUESOURCE_DATASOURCE;
16642  namespaceArray->value.dataSource = (UA_DataSource) {.handle = server, .read = readNamespaces,
16643  .write = writeNamespaces};
16644  namespaceArray->dataType = UA_TYPES[UA_TYPES_STRING].typeId;
16645  namespaceArray->valueRank = 1;
16646  namespaceArray->minimumSamplingInterval = 1.0;
16647  addNodeInternalWithType(server, (UA_Node*)namespaceArray, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16648  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16649 
16650  UA_VariableNode *serverArray = UA_NodeStore_newVariableNode();
16651  copyNames((UA_Node*)serverArray, "ServerArray");
16652  serverArray->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERARRAY;
16653  UA_Variant_setArrayCopy(&serverArray->value.data.value.value,
16654  &server->config.applicationDescription.applicationUri, 1,
16655  &UA_TYPES[UA_TYPES_STRING]);
16656  serverArray->value.data.value.hasValue = true;
16657  serverArray->valueRank = 1;
16658  serverArray->minimumSamplingInterval = 1.0;
16659  addNodeInternalWithType(server, (UA_Node*)serverArray, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16660  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16661 
16662  UA_ObjectNode *servercapablities = UA_NodeStore_newObjectNode();
16663  copyNames((UA_Node*)servercapablities, "ServerCapabilities");
16664  servercapablities->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES;
16665  addNodeInternalWithType(server, (UA_Node*)servercapablities, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16666  nodeIdHasComponent,
16667  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERCAPABILITIESTYPE));
16668  UA_NodeId ServerCapabilitiesNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES);
16669  deleteInstanceChildren(server, &ServerCapabilitiesNodeId);
16670 
16671  UA_VariableNode *localeIdArray = UA_NodeStore_newVariableNode();
16672  copyNames((UA_Node*)localeIdArray, "LocaleIdArray");
16673  localeIdArray->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_LOCALEIDARRAY;
16674  UA_String enLocale = UA_STRING("en");
16675  UA_Variant_setArrayCopy(&localeIdArray->value.data.value.value,
16676  &enLocale, 1, &UA_TYPES[UA_TYPES_STRING]);
16677  localeIdArray->value.data.value.hasValue = true;
16678  localeIdArray->valueRank = 1;
16679  localeIdArray->minimumSamplingInterval = 1.0;
16680  addNodeInternalWithType(server, (UA_Node*)localeIdArray,
16681  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16682  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16683 
16684  UA_VariableNode *maxBrowseContinuationPoints = UA_NodeStore_newVariableNode();
16685  copyNames((UA_Node*)maxBrowseContinuationPoints, "MaxBrowseContinuationPoints");
16686  maxBrowseContinuationPoints->nodeId.identifier.numeric =
16688  UA_Variant_setScalar(&maxBrowseContinuationPoints->value.data.value.value,
16689  UA_UInt16_new(), &UA_TYPES[UA_TYPES_UINT16]);
16690  maxBrowseContinuationPoints->value.data.value.hasValue = true;
16691  addNodeInternalWithType(server, (UA_Node*)maxBrowseContinuationPoints,
16692  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16693  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16694 
16696 #define MAX_PROFILEARRAY 16 //a *magic* limit to the number of supported profiles
16697 #define ADDPROFILEARRAY(x) profileArray[profileArraySize++] = UA_STRING_ALLOC(x)
16698  UA_String profileArray[MAX_PROFILEARRAY];
16699  UA_UInt16 profileArraySize = 0;
16700  ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/NanoEmbeddedDevice");
16701 
16702 #ifdef UA_ENABLE_SERVICESET_NODEMANAGEMENT
16703  ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/NodeManagement");
16704 #endif
16705 #ifdef UA_ENABLE_SERVICESET_METHOD
16706  ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/Methods");
16707 #endif
16708 #ifdef UA_ENABLE_SUBSCRIPTIONS
16709  ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/EmbeddedDataChangeSubscription");
16710 #endif
16711 
16712  UA_VariableNode *serverProfileArray = UA_NodeStore_newVariableNode();
16713  copyNames((UA_Node*)serverProfileArray, "ServerProfileArray");
16714  serverProfileArray->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_SERVERPROFILEARRAY;
16715  UA_Variant_setArray(&serverProfileArray->value.data.value.value,
16716  UA_Array_new(profileArraySize, &UA_TYPES[UA_TYPES_STRING]),
16717  profileArraySize, &UA_TYPES[UA_TYPES_STRING]);
16718  for(UA_UInt16 i=0;i<profileArraySize;++i)
16719  ((UA_String *)serverProfileArray->value.data.value.value.data)[i] = profileArray[i];
16720  serverProfileArray->value.data.value.hasValue = true;
16721  serverProfileArray->valueRank = 1;
16722  serverProfileArray->minimumSamplingInterval = 1.0;
16723  addNodeInternalWithType(server, (UA_Node*)serverProfileArray,
16724  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16725  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16726 
16727  UA_VariableNode *softwareCertificates = UA_NodeStore_newVariableNode();
16728  copyNames((UA_Node*)softwareCertificates, "SoftwareCertificates");
16729  softwareCertificates->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_SOFTWARECERTIFICATES;
16730  softwareCertificates->dataType = UA_TYPES[UA_TYPES_SIGNEDSOFTWARECERTIFICATE].typeId;
16731  addNodeInternalWithType(server, (UA_Node*)softwareCertificates,
16732  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16733  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16734 
16735  UA_VariableNode *maxQueryContinuationPoints = UA_NodeStore_newVariableNode();
16736  copyNames((UA_Node*)maxQueryContinuationPoints, "MaxQueryContinuationPoints");
16737  maxQueryContinuationPoints->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXQUERYCONTINUATIONPOINTS;
16738  UA_Variant_setScalar(&maxQueryContinuationPoints->value.data.value.value,
16739  UA_UInt16_new(), &UA_TYPES[UA_TYPES_UINT16]);
16740  maxQueryContinuationPoints->value.data.value.hasValue = true;
16741  addNodeInternalWithType(server, (UA_Node*)maxQueryContinuationPoints,
16742  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16743  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16744 
16745  UA_VariableNode *maxHistoryContinuationPoints = UA_NodeStore_newVariableNode();
16746  copyNames((UA_Node*)maxHistoryContinuationPoints, "MaxHistoryContinuationPoints");
16747  maxHistoryContinuationPoints->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXHISTORYCONTINUATIONPOINTS;
16748  UA_Variant_setScalar(&maxHistoryContinuationPoints->value.data.value.value,
16749  UA_UInt16_new(), &UA_TYPES[UA_TYPES_UINT16]);
16750  maxHistoryContinuationPoints->value.data.value.hasValue = true;
16751  addNodeInternalWithType(server, (UA_Node*)maxHistoryContinuationPoints,
16752  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16753  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16754 
16755  UA_VariableNode *minSupportedSampleRate = UA_NodeStore_newVariableNode();
16756  copyNames((UA_Node*)minSupportedSampleRate, "MinSupportedSampleRate");
16757  minSupportedSampleRate->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_MINSUPPORTEDSAMPLERATE;
16758  UA_Variant_setScalar(&minSupportedSampleRate->value.data.value.value,
16759  UA_Double_new(), &UA_TYPES[UA_TYPES_DOUBLE]);
16760  minSupportedSampleRate->value.data.value.hasValue = true;
16761  addNodeInternalWithType(server, (UA_Node*)minSupportedSampleRate,
16762  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16763  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16764 
16765  UA_ObjectNode *modellingRules = UA_NodeStore_newObjectNode();
16766  copyNames((UA_Node*)modellingRules, "ModellingRules");
16767  modellingRules->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_MODELLINGRULES;
16768  addNodeInternalWithType(server, (UA_Node*)modellingRules,
16769  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES), nodeIdHasProperty,
16770  UA_NODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE));
16771 
16772  UA_ObjectNode *aggregateFunctions = UA_NodeStore_newObjectNode();
16773  copyNames((UA_Node*)aggregateFunctions, "AggregateFunctions");
16774  aggregateFunctions->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_AGGREGATEFUNCTIONS;
16775  addNodeInternalWithType(server, (UA_Node*)aggregateFunctions,
16776  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16777  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE));
16778 
16779  UA_ObjectNode *serverdiagnostics = UA_NodeStore_newObjectNode();
16780  copyNames((UA_Node*)serverdiagnostics, "ServerDiagnostics");
16781  serverdiagnostics->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERDIAGNOSTICS;
16782  addNodeInternalWithType(server, (UA_Node*)serverdiagnostics,
16783  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16784  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERDIAGNOSTICSTYPE));
16785  UA_NodeId ServerDiagnosticsNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERDIAGNOSTICS);
16786  deleteInstanceChildren(server, &ServerDiagnosticsNodeId);
16787 
16788  UA_VariableNode *enabledFlag = UA_NodeStore_newVariableNode();
16789  copyNames((UA_Node*)enabledFlag, "EnabledFlag");
16790  enabledFlag->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERDIAGNOSTICS_ENABLEDFLAG;
16791  UA_Variant_setScalar(&enabledFlag->value.data.value.value, UA_Boolean_new(),
16792  &UA_TYPES[UA_TYPES_BOOLEAN]);
16793  enabledFlag->value.data.value.hasValue = true;
16794  enabledFlag->valueRank = 1;
16795  enabledFlag->minimumSamplingInterval = 1.0;
16796  addNodeInternalWithType(server, (UA_Node*)enabledFlag,
16797  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERDIAGNOSTICS),
16798  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16799 
16800  UA_VariableNode *serverstatus = UA_NodeStore_newVariableNode();
16801  copyNames((UA_Node*)serverstatus, "ServerStatus");
16802  serverstatus->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS);
16803  serverstatus->valueSource = UA_VALUESOURCE_DATASOURCE;
16804  serverstatus->value.dataSource = (UA_DataSource) {.handle = server, .read = readStatus,
16805  .write = NULL};
16806  addNodeInternalWithType(server, (UA_Node*)serverstatus, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16807  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16808 
16809  UA_VariableNode *starttime = UA_NodeStore_newVariableNode();
16810  copyNames((UA_Node*)starttime, "StartTime");
16811  starttime->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_STARTTIME);
16812  UA_Variant_setScalarCopy(&starttime->value.data.value.value,
16813  &server->startTime, &UA_TYPES[UA_TYPES_DATETIME]);
16814  starttime->value.data.value.hasValue = true;
16815  addNodeInternalWithType(server, (UA_Node*)starttime,
16816  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16817  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16818 
16819  UA_VariableNode *currenttime = UA_NodeStore_newVariableNode();
16820  copyNames((UA_Node*)currenttime, "CurrentTime");
16821  currenttime->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_CURRENTTIME);
16822  currenttime->valueSource = UA_VALUESOURCE_DATASOURCE;
16823  currenttime->value.dataSource = (UA_DataSource) {.handle = NULL, .read = readCurrentTime,
16824  .write = NULL};
16825  addNodeInternalWithType(server, (UA_Node*)currenttime,
16826  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16827  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16828 
16829  UA_VariableNode *state = UA_NodeStore_newVariableNode();
16830  copyNames((UA_Node*)state, "State");
16831  state->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERSTATUS_STATE;
16832  UA_Variant_setScalar(&state->value.data.value.value, UA_ServerState_new(),
16833  &UA_TYPES[UA_TYPES_SERVERSTATE]);
16834  state->value.data.value.hasValue = true;
16835  state->minimumSamplingInterval = 500.0f;
16836  addNodeInternalWithType(server, (UA_Node*)state, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16837  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16838 
16839  UA_VariableNode *buildinfo = UA_NodeStore_newVariableNode();
16840  copyNames((UA_Node*)buildinfo, "BuildInfo");
16841  buildinfo->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO);
16842  UA_Variant_setScalarCopy(&buildinfo->value.data.value.value,
16843  &server->config.buildInfo, &UA_TYPES[UA_TYPES_BUILDINFO]);
16844  buildinfo->value.data.value.hasValue = true;
16845  addNodeInternalWithType(server, (UA_Node*)buildinfo,
16846  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16847  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BUILDINFOTYPE));
16848 
16849  UA_VariableNode *producturi = UA_NodeStore_newVariableNode();
16850  copyNames((UA_Node*)producturi, "ProductUri");
16851  producturi->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTURI);
16852  UA_Variant_setScalarCopy(&producturi->value.data.value.value, &server->config.buildInfo.productUri,
16853  &UA_TYPES[UA_TYPES_STRING]);
16854  producturi->value.data.value.hasValue = true;
16855  addNodeInternalWithType(server, (UA_Node*)producturi,
16856  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16857  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16858 
16859  UA_VariableNode *manufacturername = UA_NodeStore_newVariableNode();
16860  copyNames((UA_Node*)manufacturername, "ManufacturerName");
16861  manufacturername->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_MANUFACTURERNAME);
16862  UA_Variant_setScalarCopy(&manufacturername->value.data.value.value,
16863  &server->config.buildInfo.manufacturerName,
16864  &UA_TYPES[UA_TYPES_STRING]);
16865  manufacturername->value.data.value.hasValue = true;
16866  addNodeInternalWithType(server, (UA_Node*)manufacturername,
16867  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16868  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16869 
16870  UA_VariableNode *productname = UA_NodeStore_newVariableNode();
16871  copyNames((UA_Node*)productname, "ProductName");
16872  productname->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTNAME);
16873  UA_Variant_setScalarCopy(&productname->value.data.value.value, &server->config.buildInfo.productName,
16874  &UA_TYPES[UA_TYPES_STRING]);
16875  productname->value.data.value.hasValue = true;
16876  addNodeInternalWithType(server, (UA_Node*)productname,
16877  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16878  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16879 
16880  UA_VariableNode *softwareversion = UA_NodeStore_newVariableNode();
16881  copyNames((UA_Node*)softwareversion, "SoftwareVersion");
16882  softwareversion->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_SOFTWAREVERSION);
16883  UA_Variant_setScalarCopy(&softwareversion->value.data.value.value,
16884  &server->config.buildInfo.softwareVersion, &UA_TYPES[UA_TYPES_STRING]);
16885  softwareversion->value.data.value.hasValue = true;
16886  addNodeInternalWithType(server, (UA_Node*)softwareversion,
16887  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16888  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16889 
16890  UA_VariableNode *buildnumber = UA_NodeStore_newVariableNode();
16891  copyNames((UA_Node*)buildnumber, "BuildNumber");
16892  buildnumber->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDNUMBER);
16893  UA_Variant_setScalarCopy(&buildnumber->value.data.value.value, &server->config.buildInfo.buildNumber,
16894  &UA_TYPES[UA_TYPES_STRING]);
16895  buildnumber->value.data.value.hasValue = true;
16896  addNodeInternalWithType(server, (UA_Node*)buildnumber,
16897  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16898  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16899 
16900  UA_VariableNode *builddate = UA_NodeStore_newVariableNode();
16901  copyNames((UA_Node*)builddate, "BuildDate");
16902  builddate->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDDATE);
16903  UA_Variant_setScalarCopy(&builddate->value.data.value.value, &server->config.buildInfo.buildDate,
16904  &UA_TYPES[UA_TYPES_DATETIME]);
16905  builddate->value.data.value.hasValue = true;
16906  addNodeInternalWithType(server, (UA_Node*)builddate,
16907  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16908  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16909 
16910  UA_VariableNode *secondstillshutdown = UA_NodeStore_newVariableNode();
16911  copyNames((UA_Node*)secondstillshutdown, "SecondsTillShutdown");
16912  secondstillshutdown->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_SECONDSTILLSHUTDOWN);
16913  UA_Variant_setScalar(&secondstillshutdown->value.data.value.value, UA_UInt32_new(),
16914  &UA_TYPES[UA_TYPES_UINT32]);
16915  secondstillshutdown->value.data.value.hasValue = true;
16916  addNodeInternalWithType(server, (UA_Node*)secondstillshutdown,
16917  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16918  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16919 
16920  UA_VariableNode *shutdownreason = UA_NodeStore_newVariableNode();
16921  copyNames((UA_Node*)shutdownreason, "ShutdownReason");
16922  shutdownreason->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_SHUTDOWNREASON);
16923  UA_Variant_setScalar(&shutdownreason->value.data.value.value, UA_LocalizedText_new(),
16924  &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
16925  shutdownreason->value.data.value.hasValue = true;
16926  addNodeInternalWithType(server, (UA_Node*)shutdownreason,
16927  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16928  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16929 
16930  UA_VariableNode *servicelevel = UA_NodeStore_newVariableNode();
16931  copyNames((UA_Node*)servicelevel, "ServiceLevel");
16932  servicelevel->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVICELEVEL);
16933  servicelevel->valueSource = UA_VALUESOURCE_DATASOURCE;
16934  servicelevel->value.dataSource = (UA_DataSource) {.handle = server, .read = readServiceLevel,
16935  .write = NULL};
16936  addNodeInternalWithType(server, (UA_Node*)servicelevel,
16937  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER), nodeIdHasComponent,
16938  UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16939 
16940  UA_VariableNode *auditing = UA_NodeStore_newVariableNode();
16941  copyNames((UA_Node*)auditing, "Auditing");
16942  auditing->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_AUDITING);
16943  auditing->valueSource = UA_VALUESOURCE_DATASOURCE;
16944  auditing->value.dataSource = (UA_DataSource) {.handle = server, .read = readAuditing, .write = NULL};
16945  addNodeInternalWithType(server, (UA_Node*)auditing,
16946  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER), nodeIdHasComponent,
16947  UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16948 
16949  UA_ObjectNode *vendorServerInfo = UA_NodeStore_newObjectNode();
16950  copyNames((UA_Node*)vendorServerInfo, "VendorServerInfo");
16951  vendorServerInfo->nodeId.identifier.numeric = UA_NS0ID_SERVER_VENDORSERVERINFO;
16952  addNodeInternalWithType(server, (UA_Node*)vendorServerInfo,
16953  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER), nodeIdHasProperty,
16954  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE));
16955  /*
16956  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_VENDORSERVERINFO),
16957  nodeIdHasTypeDefinition, UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_VENDORSERVERINFOTYPE), true);
16958  */
16959 
16960 
16961  UA_ObjectNode *serverRedundancy = UA_NodeStore_newObjectNode();
16962  copyNames((UA_Node*)serverRedundancy, "ServerRedundancy");
16963  serverRedundancy->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERREDUNDANCY;
16964  addNodeInternalWithType(server, (UA_Node*)serverRedundancy,
16965  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER), nodeIdHasProperty,
16966  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE));
16967  /*
16968  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERREDUNDANCY),
16969  nodeIdHasTypeDefinition, UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_SERVERREDUNDANCYTYPE), true);
16970  */
16971 
16972  UA_VariableNode *redundancySupport = UA_NodeStore_newVariableNode();
16973  copyNames((UA_Node*)redundancySupport, "RedundancySupport");
16974  redundancySupport->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERREDUNDANCY_REDUNDANCYSUPPORT);
16975  redundancySupport->valueRank = -1;
16976  redundancySupport->dataType = UA_TYPES[UA_TYPES_INT32].typeId;
16977  //FIXME: enum is needed for type letting it uninitialized for now
16978  UA_Variant_setScalar(&redundancySupport->value.data.value.value, UA_Int32_new(),
16979  &UA_TYPES[UA_TYPES_INT32]);
16980  redundancySupport->value.data.value.hasValue = true;
16981  addNodeInternalWithType(server, (UA_Node*)redundancySupport,
16982  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERREDUNDANCY),
16983  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16984 
16985 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
16986  UA_Argument inputArguments;
16987  UA_Argument_init(&inputArguments);
16988  inputArguments.dataType = UA_TYPES[UA_TYPES_UINT32].typeId;
16989  inputArguments.name = UA_STRING("SubscriptionId");
16990  inputArguments.valueRank = -1; /* scalar argument */
16991 
16992  UA_Argument outputArguments[2];
16993  UA_Argument_init(&outputArguments[0]);
16994  outputArguments[0].dataType = UA_TYPES[UA_TYPES_UINT32].typeId;
16995  outputArguments[0].name = UA_STRING("ServerHandles");
16996  outputArguments[0].valueRank = 1;
16997 
16998  UA_Argument_init(&outputArguments[1]);
16999  outputArguments[1].dataType = UA_TYPES[UA_TYPES_UINT32].typeId;
17000  outputArguments[1].name = UA_STRING("ClientHandles");
17001  outputArguments[1].valueRank = 1;
17002 
17003  UA_MethodAttributes addmethodattributes;
17004  UA_MethodAttributes_init(&addmethodattributes);
17005  addmethodattributes.displayName = UA_LOCALIZEDTEXT("", "GetMonitoredItems");
17006  addmethodattributes.executable = true;
17007  addmethodattributes.userExecutable = true;
17008 
17009  UA_Server_addMethodNode(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_GETMONITOREDITEMS),
17010  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
17011  UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
17012  UA_QUALIFIEDNAME(0, "GetMonitoredItems"), addmethodattributes,
17013  GetMonitoredItems, /* callback of the method node */
17014  NULL, /* handle passed with the callback */
17015  1, &inputArguments, 2, outputArguments, NULL);
17016 #endif
17017 
17018  return server;
17019 }
17020 
17021 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server_binary.c" ***********************************/
17022 
17023 /* This Source Code Form is subject to the terms of the Mozilla Public
17024 * License, v. 2.0. If a copy of the MPL was not distributed with this
17025 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
17026 
17027 
17028 /********************/
17029 /* Helper Functions */
17030 /********************/
17031 
17032 static void
17033 sendError(UA_SecureChannel *channel, const UA_ByteString *msg,
17034  size_t offset, const UA_DataType *responseType,
17035  UA_UInt32 requestId, UA_StatusCode error) {
17036  UA_RequestHeader requestHeader;
17037  UA_StatusCode retval = UA_RequestHeader_decodeBinary(msg, &offset, &requestHeader);
17038  if(retval != UA_STATUSCODE_GOOD)
17039  return;
17040  void *response = UA_alloca(responseType->memSize);
17041  UA_init(response, responseType);
17042  UA_ResponseHeader *responseHeader = (UA_ResponseHeader*)response;
17043  responseHeader->requestHandle = requestHeader.requestHandle;
17044  responseHeader->timestamp = UA_DateTime_now();
17045  responseHeader->serviceResult = error;
17046  UA_SecureChannel_sendBinaryMessage(channel, requestId, response, responseType);
17047  UA_RequestHeader_deleteMembers(&requestHeader);
17048  UA_ResponseHeader_deleteMembers(responseHeader);
17049 }
17050 
17051 static void
17052 getServicePointers(UA_UInt32 requestTypeId, const UA_DataType **requestType,
17053  const UA_DataType **responseType, UA_Service *service,
17054  UA_Boolean *requiresSession) {
17055  switch(requestTypeId) {
17057  *service = (UA_Service)Service_GetEndpoints;
17058  *requestType = &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST];
17059  *responseType = &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE];
17060  *requiresSession = false;
17061  break;
17063  *service = (UA_Service)Service_FindServers;
17064  *requestType = &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST];
17065  *responseType = &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE];
17066  *requiresSession = false;
17067  break;
17069  *service = (UA_Service)Service_CreateSession;
17070  *requestType = &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST];
17071  *responseType = &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE];
17072  *requiresSession = false;
17073  break;
17075  *service = (UA_Service)Service_ActivateSession;
17076  *requestType = &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST];
17077  *responseType = &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE];
17078  break;
17080  *service = (UA_Service)Service_CloseSession;
17081  *requestType = &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST];
17082  *responseType = &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE];
17083  break;
17085  *service = (UA_Service)Service_Read;
17086  *requestType = &UA_TYPES[UA_TYPES_READREQUEST];
17087  *responseType = &UA_TYPES[UA_TYPES_READRESPONSE];
17088  break;
17090  *service = (UA_Service)Service_Write;
17091  *requestType = &UA_TYPES[UA_TYPES_WRITEREQUEST];
17092  *responseType = &UA_TYPES[UA_TYPES_WRITERESPONSE];
17093  break;
17095  *service = (UA_Service)Service_Browse;
17096  *requestType = &UA_TYPES[UA_TYPES_BROWSEREQUEST];
17097  *responseType = &UA_TYPES[UA_TYPES_BROWSERESPONSE];
17098  break;
17100  *service = (UA_Service)Service_BrowseNext;
17101  *requestType = &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST];
17102  *responseType = &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE];
17103  break;
17105  *service = (UA_Service)Service_RegisterNodes;
17106  *requestType = &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST];
17107  *responseType = &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE];
17108  break;
17110  *service = (UA_Service)Service_UnregisterNodes;
17111  *requestType = &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST];
17112  *responseType = &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE];
17113  break;
17116  *requestType = &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST];
17117  *responseType = &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE];
17118  break;
17119 
17120 #ifdef UA_ENABLE_SUBSCRIPTIONS
17123  *requestType = &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST];
17124  *responseType = &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE];
17125  break;
17127  *requestType = &UA_TYPES[UA_TYPES_PUBLISHREQUEST];
17128  *responseType = &UA_TYPES[UA_TYPES_PUBLISHRESPONSE];
17129  break;
17131  *service = (UA_Service)Service_Republish;
17132  *requestType = &UA_TYPES[UA_TYPES_REPUBLISHREQUEST];
17133  *responseType = &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE];
17134  break;
17137  *requestType = &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST];
17138  *responseType = &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE];
17139  break;
17142  *requestType = &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST];
17143  *responseType = &UA_TYPES[UA_TYPES_SETPUBLISHINGMODERESPONSE];
17144  break;
17147  *requestType = &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST];
17148  *responseType = &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSRESPONSE];
17149  break;
17152  *requestType = &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSREQUEST];
17153  *responseType = &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSRESPONSE];
17154  break;
17157  *requestType = &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSREQUEST];
17158  *responseType = &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSRESPONSE];
17159  break;
17162  *requestType = &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSREQUEST];
17163  *responseType = &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSRESPONSE];
17164  break;
17167  *requestType = &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST];
17168  *responseType = &UA_TYPES[UA_TYPES_SETMONITORINGMODERESPONSE];
17169  break;
17170 #endif
17171 
17172 #ifdef UA_ENABLE_METHODCALLS
17174  *service = (UA_Service)Service_Call;
17175  *requestType = &UA_TYPES[UA_TYPES_CALLREQUEST];
17176  *responseType = &UA_TYPES[UA_TYPES_CALLRESPONSE];
17177  break;
17178 #endif
17179 
17180 #ifdef UA_ENABLE_NODEMANAGEMENT
17182  *service = (UA_Service)Service_AddNodes;
17183  *requestType = &UA_TYPES[UA_TYPES_ADDNODESREQUEST];
17184  *responseType = &UA_TYPES[UA_TYPES_ADDNODESRESPONSE];
17185  break;
17187  *service = (UA_Service)Service_AddReferences;
17188  *requestType = &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST];
17189  *responseType = &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE];
17190  break;
17192  *service = (UA_Service)Service_DeleteNodes;
17193  *requestType = &UA_TYPES[UA_TYPES_DELETENODESREQUEST];
17194  *responseType = &UA_TYPES[UA_TYPES_DELETENODESRESPONSE];
17195  break;
17198  *requestType = &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST];
17199  *responseType = &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE];
17200  break;
17201 #endif
17202 
17203  default:
17204  break;
17205  }
17206 }
17207 
17208 /*************************/
17209 /* Process Message Types */
17210 /*************************/
17211 
17212 /* HEL -> Open up the connection */
17213 static void processHEL(UA_Connection *connection, const UA_ByteString *msg, size_t *offset) {
17214  UA_TcpHelloMessage helloMessage;
17215  if(UA_TcpHelloMessage_decodeBinary(msg, offset, &helloMessage) != UA_STATUSCODE_GOOD) {
17216  connection->close(connection);
17217  return;
17218  }
17219 
17220  /* Parameterize the connection */
17221  connection->remoteConf.maxChunkCount = helloMessage.maxChunkCount; /* zero -> unlimited */
17222  connection->remoteConf.maxMessageSize = helloMessage.maxMessageSize; /* zero -> unlimited */
17223  connection->remoteConf.protocolVersion = helloMessage.protocolVersion;
17224  connection->remoteConf.recvBufferSize = helloMessage.receiveBufferSize;
17225  if(connection->localConf.sendBufferSize > helloMessage.receiveBufferSize)
17226  connection->localConf.sendBufferSize = helloMessage.receiveBufferSize;
17227  connection->remoteConf.sendBufferSize = helloMessage.sendBufferSize;
17228  if(connection->localConf.recvBufferSize > helloMessage.sendBufferSize)
17229  connection->localConf.recvBufferSize = helloMessage.sendBufferSize;
17230  connection->state = UA_CONNECTION_ESTABLISHED;
17231  UA_TcpHelloMessage_deleteMembers(&helloMessage);
17232 
17233  /* Build acknowledge response */
17234  UA_TcpAcknowledgeMessage ackMessage;
17235  ackMessage.protocolVersion = connection->localConf.protocolVersion;
17236  ackMessage.receiveBufferSize = connection->localConf.recvBufferSize;
17237  ackMessage.sendBufferSize = connection->localConf.sendBufferSize;
17238  ackMessage.maxMessageSize = connection->localConf.maxMessageSize;
17239  ackMessage.maxChunkCount = connection->localConf.maxChunkCount;
17240 
17241  UA_TcpMessageHeader ackHeader;
17243  ackHeader.messageSize = 8 + 20; /* ackHeader + ackMessage */
17244 
17245  /* Get the send buffer from the network layer */
17246  UA_ByteString ack_msg;
17247  UA_ByteString_init(&ack_msg);
17248  UA_StatusCode retval =
17249  connection->getSendBuffer(connection, connection->localConf.sendBufferSize, &ack_msg);
17250  if(retval != UA_STATUSCODE_GOOD)
17251  return;
17252 
17253  /* Encode and send the response */
17254  size_t tmpPos = 0;
17255  UA_TcpMessageHeader_encodeBinary(&ackHeader, &ack_msg, &tmpPos);
17256  UA_TcpAcknowledgeMessage_encodeBinary(&ackMessage, &ack_msg, &tmpPos);
17257  ack_msg.length = ackHeader.messageSize;
17258  connection->send(connection, &ack_msg);
17259 }
17260 
17261 /* OPN -> Open up/renew the securechannel */
17262 static void
17263 processOPN(UA_Server *server, UA_Connection *connection,
17264  UA_UInt32 channelId, const UA_ByteString *msg) {
17266  /* Called before HEL */
17267  if(connection->state != UA_CONNECTION_ESTABLISHED)
17269  /* Opening up a channel with a channelid already set */
17270  if(!connection->channel && channelId != 0)
17272  /* Renew a channel with the wrong channelid */
17273  if(connection->channel && channelId != connection->channel->securityToken.channelId)
17275 
17276  /* Decode the request */
17278  UA_SequenceHeader seqHeader;
17279  UA_NodeId requestType;
17281  size_t offset = 0;
17282  retval |= UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(msg, &offset, &asymHeader);
17283  retval |= UA_SequenceHeader_decodeBinary(msg, &offset, &seqHeader);
17284  retval |= UA_NodeId_decodeBinary(msg, &offset, &requestType);
17285  retval |= UA_OpenSecureChannelRequest_decodeBinary(msg, &offset, &r);
17286 
17287  /* Error occured */
17288  if(retval != UA_STATUSCODE_GOOD || requestType.identifier.numeric != 446) {
17289  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17290  UA_NodeId_deleteMembers(&requestType);
17291  UA_OpenSecureChannelRequest_deleteMembers(&r);
17292  connection->close(connection);
17293  return;
17294  }
17295 
17296  /* Call the service */
17298  UA_OpenSecureChannelResponse_init(&p);
17299  Service_OpenSecureChannel(server, connection, &r, &p);
17300  UA_OpenSecureChannelRequest_deleteMembers(&r);
17301 
17302  /* Opening the channel failed */
17303  UA_SecureChannel *channel = connection->channel;
17304  if(!channel) {
17305  UA_OpenSecureChannelResponse_deleteMembers(&p);
17306  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17307  connection->close(connection);
17308  return;
17309  }
17310 
17311  /* Set the starting sequence number */
17312  channel->receiveSequenceNumber = seqHeader.sequenceNumber;
17313 
17314  /* Allocate the return message */
17315  UA_ByteString resp_msg;
17316  UA_ByteString_init(&resp_msg);
17317  retval = connection->getSendBuffer(connection, connection->localConf.sendBufferSize, &resp_msg);
17318  if(retval != UA_STATUSCODE_GOOD) {
17319  UA_OpenSecureChannelResponse_deleteMembers(&p);
17320  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17321  connection->close(connection);
17322  return;
17323  }
17324 
17325  /* Encode the message after the secureconversationmessageheader */
17326  size_t tmpPos = 12; /* skip the header */
17327  seqHeader.sequenceNumber = UA_atomic_add(&channel->sendSequenceNumber, 1);
17328  retval |= UA_AsymmetricAlgorithmSecurityHeader_encodeBinary(&asymHeader, &resp_msg, &tmpPos); // just mirror back
17329  retval |= UA_SequenceHeader_encodeBinary(&seqHeader, &resp_msg, &tmpPos);
17330  UA_NodeId responseType = UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE].binaryEncodingId);
17331  retval |= UA_NodeId_encodeBinary(&responseType, &resp_msg, &tmpPos);
17332  retval |= UA_OpenSecureChannelResponse_encodeBinary(&p, &resp_msg, &tmpPos);
17333 
17334  if(retval != UA_STATUSCODE_GOOD) {
17335  connection->releaseSendBuffer(connection, &resp_msg);
17336  UA_OpenSecureChannelResponse_deleteMembers(&p);
17337  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17338  connection->close(connection);
17339  return;
17340  }
17341 
17342  /* Encode the secureconversationmessageheader (cannot fail) and send */
17345  respHeader.messageHeader.messageSize = (UA_UInt32)tmpPos;
17346  respHeader.secureChannelId = p.securityToken.channelId;
17347  tmpPos = 0;
17348  UA_SecureConversationMessageHeader_encodeBinary(&respHeader, &resp_msg, &tmpPos);
17349  resp_msg.length = respHeader.messageHeader.messageSize;
17350  connection->send(connection, &resp_msg);
17351 
17352  /* Clean up */
17353  UA_OpenSecureChannelResponse_deleteMembers(&p);
17354  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17355 }
17356 
17357 static void
17358 processMSG(UA_Server *server, UA_SecureChannel *channel,
17359  UA_UInt32 requestId, const UA_ByteString *msg) {
17360  /* At 0, the nodeid starts... */
17361  size_t ppos = 0;
17362  size_t *offset = &ppos;
17363 
17364  /* Decode the nodeid */
17365  UA_NodeId requestTypeId;
17366  UA_StatusCode retval = UA_NodeId_decodeBinary(msg, offset, &requestTypeId);
17367  if(retval != UA_STATUSCODE_GOOD)
17368  return;
17369  if(requestTypeId.identifierType != UA_NODEIDTYPE_NUMERIC)
17370  UA_NodeId_deleteMembers(&requestTypeId); /* leads to badserviceunsupported */
17371 
17372  /* Store the start-position of the request */
17373  size_t requestPos = *offset;
17374 
17375  /* Get the service pointers */
17376  UA_Service service = NULL;
17377  const UA_DataType *requestType = NULL;
17378  const UA_DataType *responseType = NULL;
17379  UA_Boolean sessionRequired = true;
17380  getServicePointers(requestTypeId.identifier.numeric, &requestType,
17381  &responseType, &service, &sessionRequired);
17382  if(!requestType) {
17383  if(requestTypeId.identifier.numeric == 787) {
17384  UA_LOG_INFO_CHANNEL(server->config.logger, channel,
17385  "Client requested a subscription, " \
17386  "but those are not enabled in the build");
17387  } else {
17388  UA_LOG_INFO_CHANNEL(server->config.logger, channel,
17389  "Unknown request with type identifier %i",
17390  requestTypeId.identifier.numeric);
17391  }
17392  sendError(channel, msg, requestPos, &UA_TYPES[UA_TYPES_SERVICEFAULT],
17394  return;
17395  }
17396  UA_assert(responseType);
17397 
17398 #ifdef UA_ENABLE_NONSTANDARD_STATELESS
17399  /* Stateless extension: Sessions are optional */
17400  sessionRequired = false;
17401 #endif
17402 
17403  /* Decode the request */
17404  void *request = UA_alloca(requestType->memSize);
17405  UA_RequestHeader *requestHeader = (UA_RequestHeader*)request;
17406  retval = UA_decodeBinary(msg, offset, request, requestType);
17407  if(retval != UA_STATUSCODE_GOOD) {
17408  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
17409  "Could not decode the request");
17410  sendError(channel, msg, requestPos, responseType, requestId, retval);
17411  return;
17412  }
17413 
17414  /* Prepare the respone */
17415  void *response = UA_alloca(responseType->memSize);
17416  UA_init(response, responseType);
17417  UA_Session *session = NULL; /* must be initialized before goto send_response */
17418 
17419  /* CreateSession doesn't need a session */
17420  if(requestType == &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST]) {
17421  Service_CreateSession(server, channel, request, response);
17422  goto send_response;
17423  }
17424 
17425  /* Find the matching session */
17426  session = UA_SecureChannel_getSession(channel, &requestHeader->authenticationToken);
17427  if(!session)
17428  session = UA_SessionManager_getSession(&server->sessionManager,
17429  &requestHeader->authenticationToken);
17430 
17431  if(requestType == &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST]) {
17432  if(!session) {
17433  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
17434  "Trying to activate a session that is " \
17435  "not known in the server");
17436  sendError(channel, msg, requestPos, responseType,
17438  UA_deleteMembers(request, requestType);
17439  return;
17440  }
17441  Service_ActivateSession(server, channel, session, request, response);
17442  goto send_response;
17443  }
17444 
17445  /* Set an anonymous, inactive session for services that need no session */
17446  UA_Session anonymousSession;
17447  if(!session) {
17448  if(sessionRequired) {
17449  UA_LOG_INFO_CHANNEL(server->config.logger, channel,
17450  "Service request %i without a valid session",
17451  requestType->binaryEncodingId);
17452  sendError(channel, msg, requestPos, responseType,
17454  UA_deleteMembers(request, requestType);
17455  return;
17456  }
17457  UA_Session_init(&anonymousSession);
17458  anonymousSession.sessionId = UA_NODEID_GUID(0, UA_GUID_NULL);
17459  anonymousSession.channel = channel;
17460  session = &anonymousSession;
17461  }
17462 
17463  /* Trying to use a non-activated session? */
17464  if(sessionRequired && !session->activated) {
17465  UA_LOG_INFO_SESSION(server->config.logger, session,
17466  "Calling service %i on a non-activated session",
17467  requestType->binaryEncodingId);
17468  sendError(channel, msg, requestPos, responseType,
17471  &session->authenticationToken);
17472  UA_deleteMembers(request, requestType);
17473  return;
17474  }
17475 
17476  /* The session is bound to another channel */
17477  if(session->channel != channel) {
17478  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
17479  "Client tries to use an obsolete securechannel");
17480  sendError(channel, msg, requestPos, responseType,
17482  UA_deleteMembers(request, requestType);
17483  return;
17484  }
17485 
17486  /* Update the session lifetime */
17487  UA_Session_updateLifetime(session);
17488 
17489 #ifdef UA_ENABLE_SUBSCRIPTIONS
17490  /* The publish request is not answered immediately */
17491  if(requestType == &UA_TYPES[UA_TYPES_PUBLISHREQUEST]) {
17492  Service_Publish(server, session, request, requestId);
17493  UA_deleteMembers(request, requestType);
17494  return;
17495  }
17496 #endif
17497 
17498  /* Call the service */
17499  UA_assert(service); /* For all services besides publish, the service pointer is non-NULL*/
17500  service(server, session, request, response);
17501 
17502  send_response:
17503  /* Send the response */
17504  ((UA_ResponseHeader*)response)->requestHandle = requestHeader->requestHandle;
17505  ((UA_ResponseHeader*)response)->timestamp = UA_DateTime_now();
17506  retval = UA_SecureChannel_sendBinaryMessage(channel, requestId, response, responseType);
17507 
17508  if(retval != UA_STATUSCODE_GOOD)
17509  UA_LOG_INFO_CHANNEL(server->config.logger, channel,
17510  "Could not send the message over the SecureChannel "
17511  "with StatusCode %s", UA_StatusCode_name(retval));
17512 
17513  /* Clean up */
17514  UA_deleteMembers(request, requestType);
17515  UA_deleteMembers(response, responseType);
17516 }
17517 
17518 /* ERR -> Error from the remote connection */
17519 static void processERR(UA_Server *server, UA_Connection *connection, const UA_ByteString *msg, size_t *offset) {
17520  UA_TcpErrorMessage errorMessage;
17521  if (UA_TcpErrorMessage_decodeBinary(msg, offset, &errorMessage) != UA_STATUSCODE_GOOD) {
17522  connection->close(connection);
17523  return;
17524  }
17525 
17526  UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_NETWORK,
17527  "Client replied with an error message: %s %.*s",
17528  UA_StatusCode_name(errorMessage.error), errorMessage.reason.length, errorMessage.reason.data);
17529 }
17530 
17531 /* Takes decoded messages starting at the nodeid of the content type. Only OPN
17532  * messages start at the asymmetricalgorithmsecurityheader and are not
17533  * decoded. */
17534 static void
17535 UA_Server_processSecureChannelMessage(UA_Server *server, UA_SecureChannel *channel,
17536  UA_MessageType messagetype, UA_UInt32 requestId,
17537  const UA_ByteString *message) {
17538  UA_assert(channel);
17539  UA_assert(channel->connection);
17540  switch(messagetype) {
17541  case UA_MESSAGETYPE_ERR: {
17542  const UA_TcpErrorMessage *msg = (const UA_TcpErrorMessage *) message;
17543  UA_LOG_ERROR_CHANNEL(server->config.logger, channel,
17544  "Client replied with an error message: %s %.*s",
17545  UA_StatusCode_name(msg->error), msg->reason.length, msg->reason.data);
17546  break;
17547  }
17548  case UA_MESSAGETYPE_HEL:
17549  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17550  "Cannot process a HEL on an open channel");
17551  break;
17552  case UA_MESSAGETYPE_OPN:
17553  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17554  "Process an OPN on an open channel");
17555  processOPN(server, channel->connection, channel->securityToken.channelId, message);
17556  break;
17557  case UA_MESSAGETYPE_MSG:
17558  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17559  "Process a MSG", channel->connection->sockfd);
17560  processMSG(server, channel, requestId, message);
17561  break;
17562  case UA_MESSAGETYPE_CLO:
17563  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17564  "Process a CLO", channel->connection->sockfd);
17565  Service_CloseSecureChannel(server, channel);
17566  break;
17567  default:
17568  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17569  "Unknown message type");
17570  }
17571 }
17572 
17573 /* Takes the raw message from the network layer */
17574 void
17575 UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection,
17576  const UA_ByteString *message) {
17577  UA_SecureChannel *channel = connection->channel;
17578  if(channel) {
17579  /* Assemble chunks in the securechannel and process complete messages */
17580  UA_StatusCode retval =
17581  UA_SecureChannel_processChunks(channel, message,
17582  (UA_ProcessMessageCallback*)UA_Server_processSecureChannelMessage, server);
17583  if(retval != UA_STATUSCODE_GOOD)
17584  UA_LOG_TRACE_CHANNEL(server->config.logger, channel, "Procesing chunks "
17585  "resulted in error code %s", UA_StatusCode_name(retval));
17586  } else {
17587  /* Process messages without a channel and no chunking */
17588  size_t offset = 0;
17589  UA_TcpMessageHeader tcpMessageHeader;
17590  UA_StatusCode retval = UA_TcpMessageHeader_decodeBinary(message, &offset, &tcpMessageHeader);
17591  if(retval != UA_STATUSCODE_GOOD) {
17592  connection->close(connection);
17593  return;
17594  }
17595 
17596  /* Dispatch according to the message type */
17597  switch(tcpMessageHeader.messageTypeAndChunkType & 0x00ffffff) {
17598  case UA_MESSAGETYPE_ERR:
17599  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17600  "Connection %i | Process ERR message", connection->sockfd);
17601  processERR(server, connection, message, &offset);
17602  break;
17603  case UA_MESSAGETYPE_HEL:
17604  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17605  "Connection %i | Process HEL message", connection->sockfd);
17606  processHEL(connection, message, &offset);
17607  break;
17608  case UA_MESSAGETYPE_OPN: {
17609  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17610  "Connection %i | Process OPN message", connection->sockfd);
17611  UA_UInt32 channelId = 0;
17612  retval = UA_UInt32_decodeBinary(message, &offset, &channelId);
17613  if(retval != UA_STATUSCODE_GOOD)
17614  connection->close(connection);
17615  UA_ByteString offsetMessage = (UA_ByteString){
17616  .data = message->data + 12, .length = message->length - 12};
17617  processOPN(server, connection, channelId, &offsetMessage);
17618  break; }
17619  case UA_MESSAGETYPE_MSG:
17620  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17621  "Connection %i | Processing a MSG message not possible "
17622  "without a SecureChannel", connection->sockfd);
17623  connection->close(connection);
17624  break;
17625  case UA_MESSAGETYPE_CLO:
17626  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17627  "Connection %i | Processing a CLO message not possible "
17628  "without a SecureChannel", connection->sockfd);
17629  connection->close(connection);
17630  break;
17631  default:
17632  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17633  "Connection %i | Unknown message type", connection->sockfd);
17634  connection->close(connection);
17635  }
17636  }
17637 }
17638 
17639 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server_utils.c" ***********************************/
17640 
17641 /* This Source Code Form is subject to the terms of the Mozilla Public
17642 * License, v. 2.0. If a copy of the MPL was not distributed with this
17643 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
17644 
17645 
17646 /**********************/
17647 /* Parse NumericRange */
17648 /**********************/
17649 
17650 static size_t
17651 readDimension(UA_Byte *buf, size_t buflen, UA_NumericRangeDimension *dim) {
17652  size_t progress = UA_readNumber(buf, buflen, &dim->min);
17653  if(progress == 0)
17654  return 0;
17655  if(buflen <= progress + 1 || buf[progress] != ':') {
17656  dim->max = dim->min;
17657  return progress;
17658  }
17659 
17660  ++progress;
17661  size_t progress2 = UA_readNumber(&buf[progress], buflen - progress, &dim->max);
17662  if(progress2 == 0)
17663  return 0;
17664 
17665  /* invalid range */
17666  if(dim->min >= dim->max)
17667  return 0;
17668 
17669  return progress + progress2;
17670 }
17671 
17674  size_t idx = 0;
17675  size_t dimensionsMax = 0;
17676  UA_NumericRangeDimension *dimensions = NULL;
17678  size_t offset = 0;
17679  while(true) {
17680  /* alloc dimensions */
17681  if(idx >= dimensionsMax) {
17682  UA_NumericRangeDimension *newds;
17683  size_t newdssize = sizeof(UA_NumericRangeDimension) * (dimensionsMax + 2);
17684  newds = UA_realloc(dimensions, newdssize);
17685  if(!newds) {
17687  break;
17688  }
17689  dimensions = newds;
17690  dimensionsMax = dimensionsMax + 2;
17691  }
17692 
17693  /* read the dimension */
17694  size_t progress = readDimension(&str->data[offset], str->length - offset,
17695  &dimensions[idx]);
17696  if(progress == 0) {
17698  break;
17699  }
17700  offset += progress;
17701  ++idx;
17702 
17703  /* loop into the next dimension */
17704  if(offset >= str->length)
17705  break;
17706 
17707  if(str->data[offset] != ',') {
17709  break;
17710  }
17711  ++offset;
17712  }
17713 
17714  if(retval == UA_STATUSCODE_GOOD && idx > 0) {
17715  range->dimensions = dimensions;
17716  range->dimensionsSize = idx;
17717  } else
17718  UA_free(dimensions);
17719 
17720  return retval;
17721 }
17722 
17723 /********************************/
17724 /* Information Model Operations */
17725 /********************************/
17726 
17728 getTypeHierarchy(UA_NodeStore *ns, const UA_Node *rootRef, UA_Boolean inverse,
17729  UA_NodeId **typeHierarchy, size_t *typeHierarchySize) {
17730  size_t results_size = 20; // probably too big, but saves mallocs
17731  UA_NodeId *results = UA_malloc(sizeof(UA_NodeId) * results_size);
17732  if(!results)
17734 
17735  UA_StatusCode retval = UA_NodeId_copy(&rootRef->nodeId, &results[0]);
17736  if(retval != UA_STATUSCODE_GOOD) {
17737  UA_free(results);
17738  return retval;
17739  }
17740 
17741  const UA_Node *node = rootRef;
17742  size_t idx = 0; /* Current index (contains NodeId of node) */
17743  size_t last = 0; /* Index of the last element in the array */
17744  const UA_NodeId hasSubtypeNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
17745  while(true) {
17746  for(size_t i = 0; i < node->referencesSize; ++i) {
17747  /* is the reference relevant? */
17748  if(node->references[i].isInverse != inverse ||
17749  !UA_NodeId_equal(&hasSubtypeNodeId, &node->references[i].referenceTypeId))
17750  continue;
17751 
17752  /* is the target already considered? (multi-inheritance) */
17753  UA_Boolean duplicate = false;
17754  for(size_t j = 0; j <= last; ++j) {
17755  if(UA_NodeId_equal(&node->references[i].targetId.nodeId, &results[j])) {
17756  duplicate = true;
17757  break;
17758  }
17759  }
17760  if(duplicate)
17761  continue;
17762 
17763  /* increase array length if necessary */
17764  if(last + 1 >= results_size) {
17765  UA_NodeId *new_results =
17766  UA_realloc(results, sizeof(UA_NodeId) * results_size * 2);
17767  if(!new_results) {
17769  break;
17770  }
17771  results = new_results;
17772  results_size *= 2;
17773  }
17774 
17775  /* copy new nodeid to the end of the list */
17776  retval = UA_NodeId_copy(&node->references[i].targetId.nodeId, &results[++last]);
17777  if(retval != UA_STATUSCODE_GOOD)
17778  break;
17779  }
17780 
17781  /* Get the next node */
17782  next:
17783  ++idx;
17784  if(idx > last || retval != UA_STATUSCODE_GOOD)
17785  break;
17786  node = UA_NodeStore_get(ns, &results[idx]);
17787  if(!node || node->nodeClass != rootRef->nodeClass)
17788  goto next;
17789  }
17790 
17791  if(retval != UA_STATUSCODE_GOOD) {
17792  UA_Array_delete(results, last, &UA_TYPES[UA_TYPES_NODEID]);
17793  return retval;
17794  }
17795 
17796  *typeHierarchy = results;
17797  *typeHierarchySize = last + 1;
17798  return UA_STATUSCODE_GOOD;
17799 }
17800 
17801 UA_Boolean
17802 isNodeInTree(UA_NodeStore *ns, const UA_NodeId *leafNode, const UA_NodeId *nodeToFind,
17803  const UA_NodeId *referenceTypeIds, size_t referenceTypeIdsSize) {
17804  if(UA_NodeId_equal(leafNode, nodeToFind))
17805  return true;
17806 
17807  const UA_Node *node = UA_NodeStore_get(ns,leafNode);
17808  if(!node)
17809  return false;
17810 
17811  /* Search upwards in the tree */
17812  for(size_t i = 0; i < node->referencesSize; ++i) {
17813  if(!node->references[i].isInverse)
17814  continue;
17815 
17816  /* Recurse only for valid reference types */
17817  for(size_t j = 0; j < referenceTypeIdsSize; ++j) {
17818  if(UA_NodeId_equal(&node->references[i].referenceTypeId, &referenceTypeIds[j]) &&
17819  isNodeInTree(ns, &node->references[i].targetId.nodeId, nodeToFind,
17820  referenceTypeIds, referenceTypeIdsSize))
17821  return true;
17822  }
17823  }
17824  return false;
17825 }
17826 
17827 const UA_Node *
17828 getNodeType(UA_Server *server, const UA_Node *node) {
17829  /* The reference to the parent is different for variable and variabletype */
17830  UA_NodeId parentRef;
17831  UA_Boolean inverse;
17832  if(node->nodeClass == UA_NODECLASS_VARIABLE ||
17833  node->nodeClass == UA_NODECLASS_OBJECT) {
17834  parentRef = UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION);
17835  inverse = false;
17836  } else if(node->nodeClass == UA_NODECLASS_VARIABLETYPE ||
17837  /* node->nodeClass == UA_NODECLASS_OBJECTTYPE || // objecttype may have multiple parents */
17838  node->nodeClass == UA_NODECLASS_REFERENCETYPE ||
17839  node->nodeClass == UA_NODECLASS_DATATYPE) {
17840  parentRef = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
17841  inverse = true;
17842  } else {
17843  return NULL;
17844  }
17845 
17846  /* stop at the first matching candidate */
17847  UA_NodeId *parentId = NULL;
17848  for(size_t i = 0; i < node->referencesSize; ++i) {
17849  if(node->references[i].isInverse == inverse &&
17850  UA_NodeId_equal(&node->references[i].referenceTypeId, &parentRef)) {
17851  parentId = &node->references[i].targetId.nodeId;
17852  break;
17853  }
17854  }
17855 
17856  if(!parentId)
17857  return NULL;
17858  return UA_NodeStore_get(server->nodestore, parentId);
17859 }
17860 
17861 const UA_VariableTypeNode *
17862 getVariableNodeType(UA_Server *server, const UA_VariableNode *node) {
17863  const UA_Node *type = getNodeType(server, (const UA_Node*)node);
17864  if(!type || type->nodeClass != UA_NODECLASS_VARIABLETYPE)
17865  return NULL;
17866  return (const UA_VariableTypeNode*)type;
17867 }
17868 
17869 const UA_ObjectTypeNode *
17870 getObjectNodeType(UA_Server *server, const UA_ObjectNode *node) {
17871  const UA_Node *type = getNodeType(server, (const UA_Node*)node);
17872  if(type->nodeClass != UA_NODECLASS_OBJECTTYPE)
17873  return NULL;
17874  return (const UA_ObjectTypeNode*)type;
17875 }
17876 
17877 UA_Boolean
17878 UA_Node_hasSubTypeOrInstances(const UA_Node *node) {
17879  const UA_NodeId hasSubType = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
17880  const UA_NodeId hasTypeDefinition = UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION);
17881  for(size_t i = 0; i < node->referencesSize; ++i) {
17882  if(node->references[i].isInverse == false &&
17883  UA_NodeId_equal(&node->references[i].referenceTypeId, &hasSubType))
17884  return true;
17885  if(node->references[i].isInverse == true &&
17886  UA_NodeId_equal(&node->references[i].referenceTypeId, &hasTypeDefinition))
17887  return true;
17888  }
17889  return false;
17890 }
17891 
17892 /* For mulithreading: make a copy of the node, edit and replace.
17893  * For singletrheading: edit the original */
17895 UA_Server_editNode(UA_Server *server, UA_Session *session,
17896  const UA_NodeId *nodeId, UA_EditNodeCallback callback,
17897  const void *data) {
17898 #ifndef UA_ENABLE_MULTITHREADING
17899  const UA_Node *node = UA_NodeStore_get(server->nodestore, nodeId);
17900  if(!node)
17902  UA_Node *editNode = (UA_Node*)(uintptr_t)node; // dirty cast
17903  return callback(server, session, editNode, data);
17904 #else
17905  UA_StatusCode retval;
17906  do {
17907  UA_Node *copy = UA_NodeStore_getCopy(server->nodestore, nodeId);
17908  if(!copy)
17910  retval = callback(server, session, copy, data);
17911  if(retval != UA_STATUSCODE_GOOD) {
17913  return retval;
17914  }
17915  retval = UA_NodeStore_replace(server->nodestore, copy);
17916  } while(retval != UA_STATUSCODE_GOOD);
17917  return UA_STATUSCODE_GOOD;
17918 #endif
17919 }
17920 
17921 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server_worker.c" ***********************************/
17922 
17923 /* This Source Code Form is subject to the terms of the Mozilla Public
17924 * License, v. 2.0. If a copy of the MPL was not distributed with this
17925 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
17926 
17927 
17963 #define MAXTIMEOUT 50 // max timeout in millisec until the next main loop iteration
17964 
17965 static void
17966 processJob(UA_Server *server, UA_Job *job) {
17968  UA_RCU_LOCK();
17969  switch(job->type) {
17970  case UA_JOBTYPE_NOTHING:
17971  break;
17972  case UA_JOBTYPE_DETACHCONNECTION:
17974  break;
17975  case UA_JOBTYPE_BINARYMESSAGE_NETWORKLAYER:
17976  UA_Server_processBinaryMessage(server, job->job.binaryMessage.connection,
17977  &job->job.binaryMessage.message);
17978  UA_Connection *connection = job->job.binaryMessage.connection;
17979  connection->releaseRecvBuffer(connection, &job->job.binaryMessage.message);
17980  break;
17981  case UA_JOBTYPE_BINARYMESSAGE_ALLOCATED:
17982  UA_Server_processBinaryMessage(server, job->job.binaryMessage.connection,
17983  &job->job.binaryMessage.message);
17984  UA_ByteString_deleteMembers(&job->job.binaryMessage.message);
17985  break;
17986  case UA_JOBTYPE_METHODCALL:
17987  case UA_JOBTYPE_METHODCALL_DELAYED:
17988  job->job.methodCall.method(server, job->job.methodCall.data);
17989  break;
17990  default:
17991  UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_SERVER,
17992  "Trying to execute a job of unknown type");
17993  break;
17994  }
17995  UA_RCU_UNLOCK();
17996 }
17997 
17998 /*******************************/
17999 /* Worker Threads and Dispatch */
18000 /*******************************/
18001 
18002 #ifdef UA_ENABLE_MULTITHREADING
18003 
18004 struct MainLoopJob {
18005  struct cds_lfs_node node;
18006  UA_Job job;
18007 };
18008 
18009 struct DispatchJob {
18010  struct cds_wfcq_node node; // node for the queue
18011  UA_Job job;
18012 };
18013 
18014 static void *
18015 workerLoop(UA_Worker *worker) {
18016  UA_Server *server = worker->server;
18017  UA_UInt32 *counter = &worker->counter;
18018  volatile UA_Boolean *running = &worker->running;
18019 
18020  /* Initialize the (thread local) random seed with the ram address of worker */
18021  UA_random_seed((uintptr_t)worker);
18022  rcu_register_thread();
18023 
18024  while(*running) {
18025  struct DispatchJob *dj = (struct DispatchJob*)
18026  cds_wfcq_dequeue_blocking(&server->dispatchQueue_head, &server->dispatchQueue_tail);
18027  if(dj) {
18028  processJob(server, &dj->job);
18029  UA_free(dj);
18030  } else {
18031  /* nothing to do. sleep until a job is dispatched (and wakes up all worker threads) */
18032  pthread_mutex_lock(&server->dispatchQueue_mutex);
18033  pthread_cond_wait(&server->dispatchQueue_condition, &server->dispatchQueue_mutex);
18034  pthread_mutex_unlock(&server->dispatchQueue_mutex);
18035  }
18036  UA_atomic_add(counter, 1);
18037  }
18038 
18040  rcu_barrier(); // wait for all scheduled call_rcu work to complete
18041  rcu_unregister_thread();
18042  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER, "Worker shut down");
18043  return NULL;
18044 }
18045 
18046 static void
18047 dispatchJob(UA_Server *server, const UA_Job *job) {
18048  struct DispatchJob *dj = UA_malloc(sizeof(struct DispatchJob));
18049  dj->job = *job;
18050  cds_wfcq_node_init(&dj->node);
18051  cds_wfcq_enqueue(&server->dispatchQueue_head, &server->dispatchQueue_tail, &dj->node);
18052 }
18053 
18054 static void
18055 emptyDispatchQueue(UA_Server *server) {
18056  while(!cds_wfcq_empty(&server->dispatchQueue_head, &server->dispatchQueue_tail)) {
18057  struct DispatchJob *dj = (struct DispatchJob*)
18058  cds_wfcq_dequeue_blocking(&server->dispatchQueue_head, &server->dispatchQueue_tail);
18059  processJob(server, &dj->job);
18060  UA_free(dj);
18061  }
18062 }
18063 
18064 #endif
18065 
18066 /*****************/
18067 /* Repeated Jobs */
18068 /*****************/
18069 
18070 /* The linked list of jobs is sorted according to the next execution timestamp */
18071 struct RepeatedJob {
18072  LIST_ENTRY(RepeatedJob) next; /* Next element in the list */
18073  UA_DateTime nextTime; /* The next time when the jobs are to be executed */
18074  UA_UInt64 interval; /* Interval in 100ns resolution */
18075  UA_Guid id; /* Id of the repeated job */
18076  UA_Job job; /* The job description itself */
18077 };
18078 
18079 /* internal. call only from the main loop. */
18080 static void
18081 addRepeatedJob(UA_Server *server, struct RepeatedJob * UA_RESTRICT rj) {
18082  /* Search for the best position on the repeatedJobs sorted list. The goal is
18083  * to have many repeated jobs with the same repetition interval in a
18084  * "block". This helps to reduce the (linear) search to find the next entry
18085  * in the repeatedJobs list when dispatching the repeated jobs.
18086  * For this, we search between "nexttime_max - 1s" and "nexttime_max" for
18087  * entries with the same repetition interval and adjust the "nexttime".
18088  * Otherwise, add entry after the first element before "nexttime_max". */
18089  UA_DateTime nextTime_max = UA_DateTime_nowMonotonic() + (UA_Int64) rj->interval;
18090 
18091  struct RepeatedJob *afterRj = NULL;
18092  struct RepeatedJob *tmpRj;
18093  LIST_FOREACH(tmpRj, &server->repeatedJobs, next) {
18094  if(tmpRj->nextTime >= nextTime_max)
18095  break;
18096  if(tmpRj->interval == rj->interval &&
18097  tmpRj->nextTime > (nextTime_max - UA_SEC_TO_DATETIME))
18098  nextTime_max = tmpRj->nextTime; /* break in the next iteration */
18099  afterRj = tmpRj;
18100  }
18101 
18102  /* add the repeated job */
18103  rj->nextTime = nextTime_max;
18104  if(afterRj)
18105  LIST_INSERT_AFTER(afterRj, rj, next);
18106  else
18107  LIST_INSERT_HEAD(&server->repeatedJobs, rj, next);
18108 }
18109 
18111 UA_Server_addRepeatedJob(UA_Server *server, UA_Job job,
18112  UA_UInt32 interval, UA_Guid *jobId) {
18113  /* the interval needs to be at least 5ms */
18114  if(interval < 5)
18116  UA_UInt64 interval_dt =
18117  (UA_UInt64)interval * (UA_UInt64)UA_MSEC_TO_DATETIME; // from ms to 100ns resolution
18118 
18119  /* Create and fill the repeated job structure */
18120  struct RepeatedJob *rj = UA_malloc(sizeof(struct RepeatedJob));
18121  if(!rj)
18123  /* done inside addRepeatedJob:
18124  * rj->nextTime = UA_DateTime_nowMonotonic() + interval_dt; */
18125  rj->interval = interval_dt;
18126  rj->id = UA_Guid_random();
18127  rj->job = job;
18128 
18129 #ifdef UA_ENABLE_MULTITHREADING
18130  /* Call addRepeatedJob from the main loop */
18131  struct MainLoopJob *mlw = UA_malloc(sizeof(struct MainLoopJob));
18132  if(!mlw) {
18133  UA_free(rj);
18135  }
18136  mlw->job = (UA_Job) {
18137  .type = UA_JOBTYPE_METHODCALL,
18138  .job.methodCall = {.data = rj, .method = (void (*)(UA_Server*, void*))addRepeatedJob}};
18139  cds_lfs_push(&server->mainLoopJobs, &mlw->node);
18140 #else
18141  /* Add directly */
18142  addRepeatedJob(server, rj);
18143 #endif
18144  if(jobId)
18145  *jobId = rj->id;
18146  return UA_STATUSCODE_GOOD;
18147 }
18148 
18149 /* - Dispatches all repeated jobs that have timed out
18150  * - Reinserts dispatched job at their new position in the sorted list
18151  * - Returns the next datetime when a repeated job is scheduled */
18152 static UA_DateTime
18153 processRepeatedJobs(UA_Server *server, UA_DateTime current, UA_Boolean *dispatched) {
18154  /* Keep pointer to the previously dispatched job to avoid linear search for
18155  * "batched" jobs with the same nexttime and interval */
18156  struct RepeatedJob tmp_last;
18157  tmp_last.nextTime = current-1; /* never matches. just to avoid if(last_added && ...) */
18158  struct RepeatedJob *last_dispatched = &tmp_last;
18159 
18160  /* Iterate over the list of elements (sorted according to the nextTime timestamp) */
18161  struct RepeatedJob *rj, *tmp_rj;
18162  LIST_FOREACH_SAFE(rj, &server->repeatedJobs, next, tmp_rj) {
18163  if(rj->nextTime > current)
18164  break;
18165 
18166  /* Dispatch/process job */
18167 #ifdef UA_ENABLE_MULTITHREADING
18168  dispatchJob(server, &rj->job);
18169  *dispatched = true;
18170 #else
18171  struct RepeatedJob **previousNext = rj->next.le_prev;
18172  processJob(server, &rj->job);
18173  /* See if the current job was deleted during processJob. That means the
18174  * le_next field of the previous repeated job (could also be the list
18175  * head) does no longer point to the current repeated job */
18176  if((void*)*previousNext != (void*)rj) {
18177  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
18178  "The current repeated job removed itself");
18179  tmp_rj = LIST_FIRST(&server->repeatedJobs);
18180  continue;
18181  }
18182 
18183  /* Was tmp_rj removed during the job? */
18184  if(LIST_NEXT(rj, next) != tmp_rj)
18185  tmp_rj = LIST_FIRST(&server->repeatedJobs);
18186 #endif
18187 
18188  /* Set the time for the next execution */
18189  rj->nextTime += (UA_Int64)rj->interval;
18190 
18191  /* Prevent an infinite loop when the repeated jobs took more time than
18192  * rj->interval */
18193  if(rj->nextTime < current)
18194  rj->nextTime = current + 1;
18195 
18196  /* Find new position for rj to keep the list sorted */
18197  struct RepeatedJob *prev_rj;
18198  if(last_dispatched->nextTime == rj->nextTime) {
18199  /* We "batch" repeatedJobs with the same interval in
18200  * addRepeatedJobs. So this might occur quite often. */
18201  UA_assert(last_dispatched != &tmp_last);
18202  prev_rj = last_dispatched;
18203  } else {
18204  /* Find the position by a linear search */
18205  prev_rj = LIST_FIRST(&server->repeatedJobs);
18206  while(true) {
18207  struct RepeatedJob *n = LIST_NEXT(prev_rj, next);
18208  if(!n || n->nextTime >= rj->nextTime)
18209  break;
18210  prev_rj = n;
18211  }
18212  }
18213 
18214  /* Add entry */
18215  if(prev_rj != rj) {
18216  LIST_REMOVE(rj, next);
18217  LIST_INSERT_AFTER(prev_rj, rj, next);
18218  }
18219 
18220  /* Update last_dispatched and loop */
18221  last_dispatched = rj;
18222  }
18223 
18224  /* Check if the next repeated job is sooner than the usual timeout */
18225  struct RepeatedJob *first = LIST_FIRST(&server->repeatedJobs);
18226  UA_DateTime next = current + (MAXTIMEOUT * UA_MSEC_TO_DATETIME);
18227  if(first && first->nextTime < next)
18228  next = first->nextTime;
18229  return next;
18230 }
18231 
18232 /* Call this function only from the main loop! */
18233 static void
18234 removeRepeatedJob(UA_Server *server, UA_Guid *jobId) {
18235  struct RepeatedJob *rj, *rj_tmp;
18236  LIST_FOREACH_SAFE(rj, &server->repeatedJobs, next, rj_tmp) {
18237  if(!UA_Guid_equal(jobId, &rj->id))
18238  continue;
18239  LIST_REMOVE(rj, next);
18240  UA_free(rj);
18241  break;
18242  }
18243 #ifdef UA_ENABLE_MULTITHREADING
18244  UA_free(jobId);
18245 #endif
18246 }
18247 
18249 #ifdef UA_ENABLE_MULTITHREADING
18250  UA_Guid *idptr = UA_malloc(sizeof(UA_Guid));
18251  if(!idptr)
18253  *idptr = jobId;
18254  // dispatch to the mainloopjobs stack
18255  struct MainLoopJob *mlw = UA_malloc(sizeof(struct MainLoopJob));
18256  mlw->job = (UA_Job) {
18257  .type = UA_JOBTYPE_METHODCALL,
18258  .job.methodCall = {.data = idptr, .method = (void (*)(UA_Server*, void*))removeRepeatedJob}};
18259  cds_lfs_push(&server->mainLoopJobs, &mlw->node);
18260 #else
18261  removeRepeatedJob(server, &jobId);
18262 #endif
18263  return UA_STATUSCODE_GOOD;
18264 }
18265 
18266 void UA_Server_deleteAllRepeatedJobs(UA_Server *server) {
18267  struct RepeatedJob *current, *temp;
18268  LIST_FOREACH_SAFE(current, &server->repeatedJobs, next, temp) {
18269  LIST_REMOVE(current, next);
18270  UA_free(current);
18271  }
18272 }
18273 
18274 /****************/
18275 /* Delayed Jobs */
18276 /****************/
18277 
18278 static void
18279 delayed_free(UA_Server *server, void *data) {
18280  UA_free(data);
18281 }
18282 
18283 UA_StatusCode UA_Server_delayedFree(UA_Server *server, void *data) {
18284  return UA_Server_delayedCallback(server, delayed_free, data);
18285 }
18286 
18287 #ifndef UA_ENABLE_MULTITHREADING
18288 
18289 typedef struct UA_DelayedJob {
18290  SLIST_ENTRY(UA_DelayedJob) next;
18291  UA_Job job;
18292 } UA_DelayedJob;
18293 
18295 UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data) {
18296  UA_DelayedJob *dj = UA_malloc(sizeof(UA_DelayedJob));
18297  if(!dj)
18299  dj->job.type = UA_JOBTYPE_METHODCALL;
18300  dj->job.job.methodCall.data = data;
18301  dj->job.job.methodCall.method = callback;
18302  SLIST_INSERT_HEAD(&server->delayedCallbacks, dj, next);
18303  return UA_STATUSCODE_GOOD;
18304 }
18305 
18306 static void
18307 processDelayedCallbacks(UA_Server *server) {
18308  UA_DelayedJob *dj, *dj_tmp;
18309  SLIST_FOREACH_SAFE(dj, &server->delayedCallbacks, next, dj_tmp) {
18310  SLIST_REMOVE(&server->delayedCallbacks, dj, UA_DelayedJob, next);
18311  processJob(server, &dj->job);
18312  UA_free(dj);
18313  }
18314 }
18315 
18316 #else
18317 
18318 #define DELAYEDJOBSSIZE 100 // Collect delayed jobs until we have DELAYEDWORKSIZE items
18319 
18320 struct DelayedJobs {
18321  struct DelayedJobs *next;
18322  UA_UInt32 *workerCounters; // initially NULL until the counter are set
18323  UA_UInt32 jobsCount; // the size of the array is DELAYEDJOBSSIZE, the count may be less
18324  UA_Job jobs[DELAYEDJOBSSIZE]; // when it runs full, a new delayedJobs entry is created
18325 };
18326 
18327 /* Dispatched as an ordinary job when the DelayedJobs list is full */
18328 static void getCounters(UA_Server *server, struct DelayedJobs *delayed) {
18329  UA_UInt32 *counters = UA_malloc(server->config.nThreads * sizeof(UA_UInt32));
18330  for(UA_UInt16 i = 0; i < server->config.nThreads; ++i)
18331  counters[i] = server->workers[i].counter;
18332  delayed->workerCounters = counters;
18333 }
18334 
18335 /* Call from the main thread only. This is the only function that modifies */
18336 /* server->delayedWork. processDelayedWorkQueue modifies the "next" (after the */
18337 /* head). */
18338 static void
18339 addDelayedJob(UA_Server *server, UA_Job *job) {
18340  struct DelayedJobs *dj = server->delayedJobs;
18341  if(!dj || dj->jobsCount >= DELAYEDJOBSSIZE) {
18342  /* create a new DelayedJobs and add it to the linked list */
18343  dj = UA_malloc(sizeof(struct DelayedJobs));
18344  if(!dj) {
18345  UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER,
18346  "Not enough memory to add a delayed job");
18347  return;
18348  }
18349  dj->jobsCount = 0;
18350  dj->workerCounters = NULL;
18351  dj->next = server->delayedJobs;
18352  server->delayedJobs = dj;
18353 
18354  /* dispatch a method that sets the counter for the full list that comes afterwards */
18355  if(dj->next) {
18356  UA_Job setCounter = (UA_Job){
18357  .type = UA_JOBTYPE_METHODCALL, .job.methodCall =
18358  {.method = (void (*)(UA_Server*, void*))getCounters, .data = dj->next}};
18359  dispatchJob(server, &setCounter);
18360  }
18361  }
18362  dj->jobs[dj->jobsCount] = *job;
18363  ++dj->jobsCount;
18364 }
18365 
18366 static void
18367 addDelayedJobAsync(UA_Server *server, UA_Job *job) {
18368  addDelayedJob(server, job);
18369  UA_free(job);
18370 }
18371 
18373 UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data) {
18374  UA_Job *j = UA_malloc(sizeof(UA_Job));
18375  if(!j)
18377  j->type = UA_JOBTYPE_METHODCALL;
18378  j->job.methodCall.data = data;
18379  j->job.methodCall.method = callback;
18380  struct MainLoopJob *mlw = UA_malloc(sizeof(struct MainLoopJob));
18381  mlw->job = (UA_Job) {.type = UA_JOBTYPE_METHODCALL, .job.methodCall =
18382  {.data = j, .method = (UA_ServerCallback)addDelayedJobAsync}};
18383  cds_lfs_push(&server->mainLoopJobs, &mlw->node);
18384  return UA_STATUSCODE_GOOD;
18385 }
18386 
18387 /* Find out which delayed jobs can be executed now */
18388 static void
18389 dispatchDelayedJobs(UA_Server *server, void *_) {
18390  /* start at the second */
18391  struct DelayedJobs *dw = server->delayedJobs, *beforedw = dw;
18392  if(dw)
18393  dw = dw->next;
18394 
18395  /* find the first delayedwork where the counters have been set and have moved */
18396  while(dw) {
18397  if(!dw->workerCounters) {
18398  beforedw = dw;
18399  dw = dw->next;
18400  continue;
18401  }
18402  UA_Boolean allMoved = true;
18403  for(size_t i = 0; i < server->config.nThreads; ++i) {
18404  if(dw->workerCounters[i] == server->workers[i].counter) {
18405  allMoved = false;
18406  break;
18407  }
18408  }
18409  if(allMoved)
18410  break;
18411  beforedw = dw;
18412  dw = dw->next;
18413  }
18414 
18415  /* process and free all delayed jobs from here on */
18416  while(dw) {
18417  for(size_t i = 0; i < dw->jobsCount; ++i)
18418  processJob(server, &dw->jobs[i]);
18419  struct DelayedJobs *next = UA_atomic_xchg((void**)&beforedw->next, NULL);
18420  UA_free(dw->workerCounters);
18421  UA_free(dw);
18422  dw = next;
18423  }
18424 }
18425 
18426 #endif
18427 
18428 /********************/
18429 /* Main Server Loop */
18430 /********************/
18431 
18432 #ifdef UA_ENABLE_MULTITHREADING
18433 static void processMainLoopJobs(UA_Server *server) {
18434  /* no synchronization required if we only use push and pop_all */
18435  struct cds_lfs_head *head = __cds_lfs_pop_all(&server->mainLoopJobs);
18436  if(!head)
18437  return;
18438  struct MainLoopJob *mlw = (struct MainLoopJob*)&head->node;
18439  struct MainLoopJob *next;
18440  do {
18441  processJob(server, &mlw->job);
18442  next = (struct MainLoopJob*)mlw->node.next;
18443  UA_free(mlw);
18444  //cppcheck-suppress unreadVariable
18445  } while((mlw = next));
18446 }
18447 #endif
18448 
18450 #ifdef UA_ENABLE_MULTITHREADING
18451  /* Spin up the worker threads */
18452  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
18453  "Spinning up %u worker thread(s)", server->config.nThreads);
18454  pthread_cond_init(&server->dispatchQueue_condition, 0);
18455  pthread_mutex_init(&server->dispatchQueue_mutex, 0);
18456  server->workers = UA_malloc(server->config.nThreads * sizeof(UA_Worker));
18457  if(!server->workers)
18459  for(size_t i = 0; i < server->config.nThreads; ++i) {
18460  UA_Worker *worker = &server->workers[i];
18461  worker->server = server;
18462  worker->counter = 0;
18463  worker->running = true;
18464  pthread_create(&worker->thr, NULL, (void* (*)(void*))workerLoop, worker);
18465  }
18466 
18467  /* Try to execute delayed callbacks every 10 sec */
18468  UA_Job processDelayed = {.type = UA_JOBTYPE_METHODCALL,
18469  .job.methodCall = {.method = dispatchDelayedJobs, .data = NULL} };
18470  UA_Server_addRepeatedJob(server, processDelayed, 10000, NULL);
18471 #endif
18472 
18473  /* Start the networklayers */
18475  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
18476  UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
18477  result |= nl->start(nl, server->config.logger);
18478  }
18479 
18480  return result;
18481 }
18482 
18483 /* completeMessages is run synchronous on the jobs returned from the network
18484  layer, so that the order for processing TCP packets is never mixed up. */
18485 static void
18486 completeMessages(UA_Server *server, UA_Job *job) {
18487  UA_Boolean realloced = UA_FALSE;
18489  &job->job.binaryMessage.message, &realloced);
18490  if(retval != UA_STATUSCODE_GOOD) {
18491  if(retval == UA_STATUSCODE_BADOUTOFMEMORY)
18492  UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_NETWORK,
18493  "Lost message(s) from Connection %i as memory could not be allocated",
18494  job->job.binaryMessage.connection->sockfd);
18495  else if(retval != UA_STATUSCODE_GOOD)
18496  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_NETWORK,
18497  "Could not merge half-received messages on Connection %i with error 0x%08x",
18498  job->job.binaryMessage.connection->sockfd, retval);
18499  job->type = UA_JOBTYPE_NOTHING;
18500  return;
18501  }
18502  if(realloced)
18503  job->type = UA_JOBTYPE_BINARYMESSAGE_ALLOCATED;
18504 
18505  /* discard the job if message is empty - also no leak is possible here */
18506  if(job->job.binaryMessage.message.length == 0)
18507  job->type = UA_JOBTYPE_NOTHING;
18508 }
18509 
18510 UA_UInt16 UA_Server_run_iterate(UA_Server *server, UA_Boolean waitInternal) {
18511 #ifdef UA_ENABLE_MULTITHREADING
18512  /* Run work assigned for the main thread */
18513  processMainLoopJobs(server);
18514 #endif
18515  /* Process repeated work */
18517  UA_Boolean dispatched = false; /* to wake up worker threads */
18518  UA_DateTime nextRepeated = processRepeatedJobs(server, now, &dispatched);
18519 
18520  UA_UInt16 timeout = 0;
18521  if(waitInternal)
18522  timeout = (UA_UInt16)((nextRepeated - now) / UA_MSEC_TO_DATETIME);
18523 
18524  /* Get work from the networklayer */
18525  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
18526  UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
18527  UA_Job *jobs = NULL;
18528  size_t jobsSize;
18529  /* only the last networklayer waits on the tieout */
18530  if(i == server->config.networkLayersSize-1)
18531  jobsSize = nl->getJobs(nl, &jobs, timeout);
18532  else
18533  jobsSize = nl->getJobs(nl, &jobs, 0);
18534 
18535  for(size_t k = 0; k < jobsSize; ++k) {
18536 #ifdef UA_ENABLE_MULTITHREADING
18537  /* Filter out delayed work */
18538  if(jobs[k].type == UA_JOBTYPE_METHODCALL_DELAYED) {
18539  addDelayedJob(server, &jobs[k]);
18540  jobs[k].type = UA_JOBTYPE_NOTHING;
18541  continue;
18542  }
18543 #endif
18544  /* Merge half-received messages */
18545  if(jobs[k].type == UA_JOBTYPE_BINARYMESSAGE_NETWORKLAYER)
18546  completeMessages(server, &jobs[k]);
18547  }
18548 
18549  /* Dispatch/process jobs */
18550  for(size_t j = 0; j < jobsSize; ++j) {
18551 #ifdef UA_ENABLE_MULTITHREADING
18552  dispatchJob(server, &jobs[j]);
18553  dispatched = true;
18554 #else
18555  processJob(server, &jobs[j]);
18556 #endif
18557  }
18558 
18559  /* Clean up jobs list */
18560  if(jobsSize > 0)
18561  UA_free(jobs);
18562  }
18563 
18564 #ifdef UA_ENABLE_MULTITHREADING
18565  /* Wake up worker threads */
18566  if(dispatched)
18567  pthread_cond_broadcast(&server->dispatchQueue_condition);
18568 #else
18569  processDelayedCallbacks(server);
18570 #endif
18571 
18572  now = UA_DateTime_nowMonotonic();
18573  timeout = 0;
18574  if(nextRepeated > now)
18575  timeout = (UA_UInt16)((nextRepeated - now) / UA_MSEC_TO_DATETIME);
18576  return timeout;
18577 }
18578 
18580  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
18581  UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
18582  UA_Job *stopJobs = NULL;
18583  size_t stopJobsSize = nl->stop(nl, &stopJobs);
18584  for(size_t j = 0; j < stopJobsSize; ++j)
18585  processJob(server, &stopJobs[j]);
18586  UA_free(stopJobs);
18587  }
18588 
18589 #ifdef UA_ENABLE_MULTITHREADING
18590  /* Ensure that run_shutdown can be called multiple times */
18591  if(server->workers) {
18592  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
18593  "Shutting down %u worker thread(s)", server->config.nThreads);
18594  /* Wait for all worker threads to finish */
18595  for(size_t i = 0; i < server->config.nThreads; ++i)
18596  server->workers[i].running = false;
18597  pthread_cond_broadcast(&server->dispatchQueue_condition);
18598  for(size_t i = 0; i < server->config.nThreads; ++i)
18599  pthread_join(server->workers[i].thr, NULL);
18600  /* Free the worker structures */
18601  UA_free(server->workers);
18602  server->workers = NULL;
18603  }
18604 
18605  /* Manually finish the work still enqueued */
18606  emptyDispatchQueue(server);
18608  rcu_barrier(); // wait for all scheduled call_rcu work to complete
18609 #else
18610  processDelayedCallbacks(server);
18611 #endif
18612  return UA_STATUSCODE_GOOD;
18613 }
18614 
18615 UA_StatusCode UA_Server_run(UA_Server *server, volatile UA_Boolean *running) {
18616  UA_StatusCode retval = UA_Server_run_startup(server);
18617  if(retval != UA_STATUSCODE_GOOD)
18618  return retval;
18619  while(*running)
18620  UA_Server_run_iterate(server, true);
18621  return UA_Server_run_shutdown(server);
18622 }
18623 
18624 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_securechannel_manager.c" ***********************************/
18625 
18626 /* This Source Code Form is subject to the terms of the Mozilla Public
18627 * License, v. 2.0. If a copy of the MPL was not distributed with this
18628 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
18629 
18630 
18631 #define STARTCHANNELID 1
18632 #define STARTTOKENID 1
18633 
18636  LIST_INIT(&cm->channels);
18637  cm->lastChannelId = STARTCHANNELID;
18638  cm->lastTokenId = STARTTOKENID;
18639  cm->currentChannelCount = 0;
18640  cm->server = server;
18641  return UA_STATUSCODE_GOOD;
18642 }
18643 
18645  channel_list_entry *entry, *temp;
18646  LIST_FOREACH_SAFE(entry, &cm->channels, pointers, temp) {
18647  LIST_REMOVE(entry, pointers);
18649  UA_free(entry);
18650  }
18651 }
18652 
18653 static void
18654 removeSecureChannelCallback(UA_Server *server, void *entry) {
18655  channel_list_entry *centry = (channel_list_entry*)entry;
18657  UA_free(entry);
18658 }
18659 
18660 static UA_StatusCode
18661 removeSecureChannel(UA_SecureChannelManager *cm, channel_list_entry *entry){
18662  /* Add a delayed callback to remove the channel when the currently
18663  * scheduled jobs have completed */
18664  UA_StatusCode retval = UA_Server_delayedCallback(cm->server, removeSecureChannelCallback, entry);
18665  if(retval != UA_STATUSCODE_GOOD) {
18666  UA_LOG_WARNING(cm->server->config.logger, UA_LOGCATEGORY_SESSION,
18667  "Could not remove the secure channel with error code %s",
18668  UA_StatusCode_name(retval));
18669  return retval; /* Try again next time */
18670  }
18671 
18672  /* Detach the channel and make the capacity available */
18673  LIST_REMOVE(entry, pointers);
18674  UA_atomic_add(&cm->currentChannelCount, (UA_UInt32)-1);
18675  return UA_STATUSCODE_GOOD;
18676 }
18677 
18678 /* remove channels that were not renewed or who have no connection attached */
18679 void
18681  channel_list_entry *entry, *temp;
18682  LIST_FOREACH_SAFE(entry, &cm->channels, pointers, temp) {
18683  UA_DateTime timeout = entry->channel.securityToken.createdAt +
18685  if(timeout < nowMonotonic || !entry->channel.connection) {
18686  UA_LOG_INFO_CHANNEL(cm->server->config.logger, &entry->channel,
18687  "SecureChannel has timed out");
18688  removeSecureChannel(cm, entry);
18689  } else if(entry->channel.nextSecurityToken.tokenId > 0) {
18691  }
18692  }
18693 }
18694 
18695 /* remove the first channel that has no session attached */
18696 static UA_Boolean purgeFirstChannelWithoutSession(UA_SecureChannelManager *cm) {
18697  channel_list_entry *entry;
18698  LIST_FOREACH(entry, &cm->channels, pointers) {
18699  if(LIST_EMPTY(&(entry->channel.sessions))){
18700  UA_LOG_DEBUG_CHANNEL(cm->server->config.logger, &entry->channel,
18701  "Channel was purged since maxSecureChannels was "
18702  "reached and channel had no session attached");
18703  removeSecureChannel(cm, entry);
18704  UA_assert(entry != LIST_FIRST(&cm->channels));
18705  return true;
18706  }
18707  }
18708  return false;
18709 }
18710 
18713  const UA_OpenSecureChannelRequest *request,
18714  UA_OpenSecureChannelResponse *response) {
18717 
18718  //check if there exists a free SC, otherwise try to purge one SC without a session
18719  //the purge has been introduced to pass CTT, it is not clear what strategy is expected here
18720  if(cm->currentChannelCount >= cm->server->config.maxSecureChannels && !purgeFirstChannelWithoutSession(cm)){
18722  }
18723 
18724  /* Set up the channel */
18726  if(!entry)
18728  UA_SecureChannel_init(&entry->channel);
18729  entry->channel.securityToken.channelId = cm->lastChannelId++;
18730  entry->channel.securityToken.tokenId = cm->lastTokenId++;
18733  (request->requestedLifetime > cm->server->config.maxSecurityTokenLifetime) ?
18734  cm->server->config.maxSecurityTokenLifetime : request->requestedLifetime;
18735  if(entry->channel.securityToken.revisedLifetime == 0) /* lifetime 0 -> set the maximum possible */
18736  entry->channel.securityToken.revisedLifetime = cm->server->config.maxSecurityTokenLifetime;
18737  UA_ByteString_copy(&request->clientNonce, &entry->channel.clientNonce);
18739  UA_STRING_ALLOC("http://opcfoundation.org/UA/SecurityPolicy#None");
18741 
18742  /* Set the response */
18743  UA_ByteString_copy(&entry->channel.serverNonce, &response->serverNonce);
18744  UA_ChannelSecurityToken_copy(&entry->channel.securityToken, &response->securityToken);
18746 
18747  /* Now overwrite the creation date with the internal monotonic clock */
18749 
18750  /* Set all the pointers internally */
18752  LIST_INSERT_HEAD(&cm->channels, entry, pointers);
18753  UA_atomic_add(&cm->currentChannelCount, 1);
18754  return UA_STATUSCODE_GOOD;
18755 }
18756 
18759  const UA_OpenSecureChannelRequest *request,
18760  UA_OpenSecureChannelResponse *response) {
18761  UA_SecureChannel *channel = conn->channel;
18762  if(!channel)
18764 
18765  /* if no security token is already issued */
18766  if(channel->nextSecurityToken.tokenId == 0) {
18767  channel->nextSecurityToken.channelId = channel->securityToken.channelId;
18768  channel->nextSecurityToken.tokenId = cm->lastTokenId++;
18771  (request->requestedLifetime > cm->server->config.maxSecurityTokenLifetime) ?
18772  cm->server->config.maxSecurityTokenLifetime : request->requestedLifetime;
18773  if(channel->nextSecurityToken.revisedLifetime == 0) /* lifetime 0 -> return the max lifetime */
18774  channel->nextSecurityToken.revisedLifetime = cm->server->config.maxSecurityTokenLifetime;
18775  }
18776 
18777  /* invalidate the old nonce */
18778  if(channel->clientNonce.data)
18779  UA_ByteString_deleteMembers(&channel->clientNonce);
18780 
18781  /* set the response */
18782  UA_ByteString_copy(&request->clientNonce, &channel->clientNonce);
18783  UA_ByteString_copy(&channel->serverNonce, &response->serverNonce);
18784  UA_ChannelSecurityToken_copy(&channel->nextSecurityToken, &response->securityToken);
18785 
18786  /* reset the creation date to the monotonic clock */
18788 
18789  return UA_STATUSCODE_GOOD;
18790 }
18791 
18794  channel_list_entry *entry;
18795  LIST_FOREACH(entry, &cm->channels, pointers) {
18796  if(entry->channel.securityToken.channelId == channelId)
18797  return &entry->channel;
18798  }
18799  return NULL;
18800 }
18801 
18804  channel_list_entry *entry;
18805  LIST_FOREACH(entry, &cm->channels, pointers) {
18806  if(entry->channel.securityToken.channelId == channelId)
18807  break;
18808  }
18809  if(!entry)
18811  return removeSecureChannel(cm, entry);
18812 }
18813 
18814 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_session_manager.c" ***********************************/
18815 
18816 /* This Source Code Form is subject to the terms of the Mozilla Public
18817 * License, v. 2.0. If a copy of the MPL was not distributed with this
18818 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
18819 
18820 
18823  LIST_INIT(&sm->sessions);
18824  sm->currentSessionCount = 0;
18825  sm->server = server;
18826  return UA_STATUSCODE_GOOD;
18827 }
18828 
18830  session_list_entry *current, *temp;
18831  LIST_FOREACH_SAFE(current, &sm->sessions, pointers, temp) {
18832  LIST_REMOVE(current, pointers);
18833  UA_Session_deleteMembersCleanup(&current->session, sm->server);
18834  UA_free(current);
18835  }
18836 }
18837 
18838 /* Delayed callback to free the session memory */
18839 static void
18840 removeSessionCallback(UA_Server *server, void *entry) {
18841  session_list_entry *sentry = (session_list_entry*)entry;
18842  UA_Session_deleteMembersCleanup(&sentry->session, server);
18843  UA_free(sentry);
18844 }
18845 
18846 static UA_StatusCode
18847 removeSession(UA_SessionManager *sm, session_list_entry *sentry) {
18848  /* Deactivate the session */
18849  sentry->session.activated = false;
18850 
18851  /* Add a delayed callback to remove the session when the currently
18852  * scheduled jobs have completed */
18853  UA_StatusCode retval = UA_Server_delayedCallback(sm->server, removeSessionCallback, sentry);
18854  if(retval != UA_STATUSCODE_GOOD) {
18855  UA_LOG_WARNING_SESSION(sm->server->config.logger, &sentry->session,
18856  "Could not remove session with error code %s",
18857  UA_StatusCode_name(retval));
18858  return retval; /* Try again next time */
18859  }
18860 
18861  /* Detach the session and make the capacity available */
18862  LIST_REMOVE(sentry, pointers);
18863  UA_atomic_add(&sm->currentSessionCount, (UA_UInt32)-1);
18864  return UA_STATUSCODE_GOOD;
18865 }
18866 
18867 void
18869  UA_DateTime nowMonotonic) {
18870  session_list_entry *sentry, *temp;
18871  LIST_FOREACH_SAFE(sentry, &sm->sessions, pointers, temp) {
18872  /* Session has timed out? */
18873  if(sentry->session.validTill >= nowMonotonic)
18874  continue;
18875  UA_LOG_INFO_SESSION(sm->server->config.logger, &sentry->session,
18876  "Session has timed out");
18877  removeSession(sm, sentry);
18878  }
18879 }
18880 
18881 UA_Session *
18883  session_list_entry *current = NULL;
18884  LIST_FOREACH(current, &sm->sessions, pointers) {
18885  /* Token does not match */
18886  if(!UA_NodeId_equal(&current->session.authenticationToken, token))
18887  continue;
18888 
18889  /* Session has timed out */
18890  if(UA_DateTime_nowMonotonic() > current->session.validTill) {
18891  UA_LOG_INFO_SESSION(sm->server->config.logger, &current->session,
18892  "Client tries to use a session that has timed out");
18893  return NULL;
18894  }
18895 
18896  /* Ok, return */
18897  return &current->session;
18898  }
18899 
18900  /* Session not found */
18901  UA_LOG_INFO(sm->server->config.logger, UA_LOGCATEGORY_SESSION,
18902  "Try to use Session with token " UA_PRINTF_GUID_FORMAT " but is not found",
18904  return NULL;
18905 }
18906 
18907 /* Creates and adds a session. But it is not yet attached to a secure channel. */
18910  const UA_CreateSessionRequest *request, UA_Session **session) {
18911  if(sm->currentSessionCount >= sm->server->config.maxSessions)
18913 
18914  session_list_entry *newentry = UA_malloc(sizeof(session_list_entry));
18915  if(!newentry)
18917 
18918  UA_atomic_add(&sm->currentSessionCount, 1);
18919  UA_Session_init(&newentry->session);
18920  newentry->session.sessionId = UA_NODEID_GUID(1, UA_Guid_random());
18921  newentry->session.authenticationToken = UA_NODEID_GUID(1, UA_Guid_random());
18922 
18923  if(request->requestedSessionTimeout <= sm->server->config.maxSessionTimeout &&
18924  request->requestedSessionTimeout > 0)
18925  newentry->session.timeout = request->requestedSessionTimeout;
18926  else
18927  newentry->session.timeout = sm->server->config.maxSessionTimeout;
18928 
18929  UA_Session_updateLifetime(&newentry->session);
18930  LIST_INSERT_HEAD(&sm->sessions, newentry, pointers);
18931  *session = &newentry->session;
18932  return UA_STATUSCODE_GOOD;
18933 }
18934 
18937  session_list_entry *current;
18938  LIST_FOREACH(current, &sm->sessions, pointers) {
18939  if(UA_NodeId_equal(&current->session.authenticationToken, token))
18940  break;
18941  }
18942  if(!current)
18944  return removeSession(sm, current);
18945 }
18946 
18947 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodes.c" ***********************************/
18948 
18949 /* This Source Code Form is subject to the terms of the Mozilla Public
18950 * License, v. 2.0. If a copy of the MPL was not distributed with this
18951 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
18952 
18953 
18955  /* delete standard content */
18956  UA_NodeId_deleteMembers(&node->nodeId);
18957  UA_QualifiedName_deleteMembers(&node->browseName);
18958  UA_LocalizedText_deleteMembers(&node->displayName);
18959  UA_LocalizedText_deleteMembers(&node->description);
18960  UA_Array_delete(node->references, node->referencesSize,
18962  node->references = NULL;
18963  node->referencesSize = 0;
18964 
18965  /* delete unique content of the nodeclass */
18966  switch(node->nodeClass) {
18967  case UA_NODECLASS_OBJECT:
18968  break;
18969  case UA_NODECLASS_METHOD:
18970  break;
18972  break;
18973  case UA_NODECLASS_VARIABLE:
18975  UA_VariableNode *p = (UA_VariableNode*)node;
18976  UA_NodeId_deleteMembers(&p->dataType);
18977  UA_Array_delete(p->arrayDimensions, p->arrayDimensionsSize,
18979  p->arrayDimensions = NULL;
18980  p->arrayDimensionsSize = 0;
18981  if(p->valueSource == UA_VALUESOURCE_DATA)
18982  UA_DataValue_deleteMembers(&p->value.data.value);
18983  break;
18984  }
18987  UA_LocalizedText_deleteMembers(&p->inverseName);
18988  break;
18989  }
18990  case UA_NODECLASS_DATATYPE:
18991  break;
18992  case UA_NODECLASS_VIEW:
18993  break;
18994  default:
18995  break;
18996  }
18997 }
18998 
18999 static UA_StatusCode
19000 UA_ObjectNode_copy(const UA_ObjectNode *src, UA_ObjectNode *dst) {
19001  dst->eventNotifier = src->eventNotifier;
19002  dst->instanceHandle = src->instanceHandle;
19003  return UA_STATUSCODE_GOOD;
19004 }
19005 
19006 static UA_StatusCode
19007 UA_CommonVariableNode_copy(const UA_VariableNode *src, UA_VariableNode *dst) {
19008  UA_StatusCode retval = UA_Array_copy(src->arrayDimensions,
19009  src->arrayDimensionsSize,
19010  (void**)&dst->arrayDimensions,
19012  if(retval != UA_STATUSCODE_GOOD)
19013  return retval;
19014  dst->arrayDimensionsSize = src->arrayDimensionsSize;
19015  retval = UA_NodeId_copy(&src->dataType, &dst->dataType);
19016  dst->valueRank = src->valueRank;
19017  dst->valueSource = src->valueSource;
19018  if(src->valueSource == UA_VALUESOURCE_DATA) {
19019  retval |= UA_DataValue_copy(&src->value.data.value,
19020  &dst->value.data.value);
19021  dst->value.data.callback = src->value.data.callback;
19022  } else
19023  dst->value.dataSource = src->value.dataSource;
19024  return retval;
19025 }
19026 
19027 static UA_StatusCode
19028 UA_VariableNode_copy(const UA_VariableNode *src, UA_VariableNode *dst) {
19029  UA_StatusCode retval = UA_CommonVariableNode_copy(src, dst);
19030  dst->accessLevel = src->accessLevel;
19031  dst->userAccessLevel = src->userAccessLevel;
19033  dst->historizing = src->historizing;
19034  return retval;
19035 }
19036 
19037 static UA_StatusCode
19038 UA_VariableTypeNode_copy(const UA_VariableTypeNode *src,
19039  UA_VariableTypeNode *dst) {
19040  UA_StatusCode retval = UA_CommonVariableNode_copy((const UA_VariableNode*)src,
19041  (UA_VariableNode*)dst);
19042  dst->isAbstract = src->isAbstract;
19043  return retval;
19044 }
19045 
19046 static UA_StatusCode
19047 UA_MethodNode_copy(const UA_MethodNode *src, UA_MethodNode *dst) {
19048  dst->executable = src->executable;
19049  dst->userExecutable = src->userExecutable;
19050  dst->methodHandle = src->methodHandle;
19051  dst->attachedMethod = src->attachedMethod;
19052  return UA_STATUSCODE_GOOD;
19053 }
19054 
19055 static UA_StatusCode
19056 UA_ObjectTypeNode_copy(const UA_ObjectTypeNode *src, UA_ObjectTypeNode *dst) {
19057  dst->isAbstract = src->isAbstract;
19059  return UA_STATUSCODE_GOOD;
19060 }
19061 
19062 static UA_StatusCode
19063 UA_ReferenceTypeNode_copy(const UA_ReferenceTypeNode *src,
19064  UA_ReferenceTypeNode *dst) {
19065  UA_StatusCode retval = UA_LocalizedText_copy(&src->inverseName,
19066  &dst->inverseName);
19067  dst->isAbstract = src->isAbstract;
19068  dst->symmetric = src->symmetric;
19069  return retval;
19070 }
19071 
19072 static UA_StatusCode
19073 UA_DataTypeNode_copy(const UA_DataTypeNode *src, UA_DataTypeNode *dst) {
19074  dst->isAbstract = src->isAbstract;
19075  return UA_STATUSCODE_GOOD;
19076 }
19077 
19078 static UA_StatusCode
19079 UA_ViewNode_copy(const UA_ViewNode *src, UA_ViewNode *dst) {
19080  dst->containsNoLoops = src->containsNoLoops;
19081  dst->eventNotifier = src->eventNotifier;
19082  return UA_STATUSCODE_GOOD;
19083 }
19084 
19085 UA_StatusCode UA_Node_copyAnyNodeClass(const UA_Node *src, UA_Node *dst) {
19086  if(src->nodeClass != dst->nodeClass)
19088 
19089  /* copy standard content */
19090  UA_StatusCode retval = UA_NodeId_copy(&src->nodeId, &dst->nodeId);
19091  dst->nodeClass = src->nodeClass;
19092  retval |= UA_QualifiedName_copy(&src->browseName, &dst->browseName);
19093  retval |= UA_LocalizedText_copy(&src->displayName, &dst->displayName);
19094  retval |= UA_LocalizedText_copy(&src->description, &dst->description);
19095  dst->writeMask = src->writeMask;
19096  dst->userWriteMask = src->userWriteMask;
19097  if(retval != UA_STATUSCODE_GOOD) {
19099  return retval;
19100  }
19101  retval |= UA_Array_copy(src->references, src->referencesSize,
19102  (void**)&dst->references,
19104  if(retval != UA_STATUSCODE_GOOD) {
19106  return retval;
19107  }
19108  dst->referencesSize = src->referencesSize;
19109 
19110  /* copy unique content of the nodeclass */
19111  switch(src->nodeClass) {
19112  case UA_NODECLASS_OBJECT:
19113  retval = UA_ObjectNode_copy((const UA_ObjectNode*)src,
19114  (UA_ObjectNode*)dst);
19115  break;
19116  case UA_NODECLASS_VARIABLE:
19117  retval = UA_VariableNode_copy((const UA_VariableNode*)src,
19118  (UA_VariableNode*)dst);
19119  break;
19120  case UA_NODECLASS_METHOD:
19121  retval = UA_MethodNode_copy((const UA_MethodNode*)src,
19122  (UA_MethodNode*)dst);
19123  break;
19125  retval = UA_ObjectTypeNode_copy((const UA_ObjectTypeNode*)src,
19126  (UA_ObjectTypeNode*)dst);
19127  break;
19129  retval = UA_VariableTypeNode_copy((const UA_VariableTypeNode*)src,
19130  (UA_VariableTypeNode*)dst);
19131  break;
19133  retval = UA_ReferenceTypeNode_copy((const UA_ReferenceTypeNode*)src,
19134  (UA_ReferenceTypeNode*)dst);
19135  break;
19136  case UA_NODECLASS_DATATYPE:
19137  retval = UA_DataTypeNode_copy((const UA_DataTypeNode*)src,
19138  (UA_DataTypeNode*)dst);
19139  break;
19140  case UA_NODECLASS_VIEW:
19141  retval = UA_ViewNode_copy((const UA_ViewNode*)src, (UA_ViewNode*)dst);
19142  break;
19143  default:
19144  break;
19145  }
19146 
19147  if(retval != UA_STATUSCODE_GOOD)
19149 
19150  return retval;
19151 }
19152 
19153 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodestore.c" ***********************************/
19154 
19155 /* This Source Code Form is subject to the terms of the Mozilla Public
19156 * License, v. 2.0. If a copy of the MPL was not distributed with this
19157 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19158 
19159 
19160 #ifndef UA_ENABLE_MULTITHREADING /* conditional compilation */
19161 
19162 #define UA_NODESTORE_MINSIZE 64
19163 
19164 typedef struct UA_NodeStoreEntry {
19165  struct UA_NodeStoreEntry *orig; // the version this is a copy from (or NULL)
19166  UA_Node node;
19168 
19169 #define UA_NODESTORE_TOMBSTONE ((UA_NodeStoreEntry*)0x01)
19170 
19176 };
19177 
19178 /* The size of the hash-map is always a prime number. They are chosen to be
19179  * close to the next power of 2. So the size ca. doubles with each prime. */
19180 static UA_UInt32 const primes[] = {
19181  7, 13, 31, 61, 127, 251,
19182  509, 1021, 2039, 4093, 8191, 16381,
19183  32749, 65521, 131071, 262139, 524287, 1048573,
19184  2097143, 4194301, 8388593, 16777213, 33554393, 67108859,
19185  134217689, 268435399, 536870909, 1073741789, 2147483647, 4294967291
19186 };
19187 
19188 static UA_UInt32 mod(UA_UInt32 h, UA_UInt32 size) { return h % size; }
19189 static UA_UInt32 mod2(UA_UInt32 h, UA_UInt32 size) { return 1 + (h % (size - 2)); }
19190 
19191 static UA_UInt16
19192 higher_prime_index(UA_UInt32 n) {
19193  UA_UInt16 low = 0;
19194  UA_UInt16 high = (UA_UInt16)(sizeof(primes) / sizeof(UA_UInt32));
19195  while(low != high) {
19196  UA_UInt16 mid = (UA_UInt16)(low + ((high - low) / 2));
19197  if(n > primes[mid])
19198  low = (UA_UInt16)(mid + 1);
19199  else
19200  high = mid;
19201  }
19202  return low;
19203 }
19204 
19205 static UA_NodeStoreEntry *
19206 instantiateEntry(UA_NodeClass nodeClass) {
19207  size_t size = sizeof(UA_NodeStoreEntry) - sizeof(UA_Node);
19208  switch(nodeClass) {
19209  case UA_NODECLASS_OBJECT:
19210  size += sizeof(UA_ObjectNode);
19211  break;
19212  case UA_NODECLASS_VARIABLE:
19213  size += sizeof(UA_VariableNode);
19214  break;
19215  case UA_NODECLASS_METHOD:
19216  size += sizeof(UA_MethodNode);
19217  break;
19219  size += sizeof(UA_ObjectTypeNode);
19220  break;
19222  size += sizeof(UA_VariableTypeNode);
19223  break;
19225  size += sizeof(UA_ReferenceTypeNode);
19226  break;
19227  case UA_NODECLASS_DATATYPE:
19228  size += sizeof(UA_DataTypeNode);
19229  break;
19230  case UA_NODECLASS_VIEW:
19231  size += sizeof(UA_ViewNode);
19232  break;
19233  default:
19234  return NULL;
19235  }
19236  UA_NodeStoreEntry *entry = UA_calloc(1, size);
19237  if(!entry)
19238  return NULL;
19239  entry->node.nodeClass = nodeClass;
19240  return entry;
19241 }
19242 
19243 static void
19244 deleteEntry(UA_NodeStoreEntry *entry) {
19246  UA_free(entry);
19247 }
19248 
19249 /* returns slot of a valid node or null */
19250 static UA_NodeStoreEntry **
19251 findNode(const UA_NodeStore *ns, const UA_NodeId *nodeid) {
19252  UA_UInt32 h = UA_NodeId_hash(nodeid);
19253  UA_UInt32 size = ns->size;
19254  UA_UInt32 idx = mod(h, size);
19255  UA_UInt32 hash2 = mod2(h, size);
19256 
19257  while(true) {
19258  UA_NodeStoreEntry *e = ns->entries[idx];
19259  if(!e)
19260  return NULL;
19261  if(e > UA_NODESTORE_TOMBSTONE &&
19262  UA_NodeId_equal(&e->node.nodeId, nodeid))
19263  return &ns->entries[idx];
19264  idx += hash2;
19265  if(idx >= size)
19266  idx -= size;
19267  }
19268 
19269  /* NOTREACHED */
19270  return NULL;
19271 }
19272 
19273 /* returns an empty slot or null if the nodeid exists */
19274 static UA_NodeStoreEntry **
19275 findSlot(const UA_NodeStore *ns, const UA_NodeId *nodeid) {
19276  UA_UInt32 h = UA_NodeId_hash(nodeid);
19277  UA_UInt32 size = ns->size;
19278  UA_UInt32 idx = mod(h, size);
19279  UA_UInt32 hash2 = mod2(h, size);
19280 
19281  while(true) {
19282  UA_NodeStoreEntry *e = ns->entries[idx];
19283  if(e > UA_NODESTORE_TOMBSTONE &&
19284  UA_NodeId_equal(&e->node.nodeId, nodeid))
19285  return NULL;
19286  if(ns->entries[idx] <= UA_NODESTORE_TOMBSTONE)
19287  return &ns->entries[idx];
19288  idx += hash2;
19289  if(idx >= size)
19290  idx -= size;
19291  }
19292 
19293  /* NOTREACHED */
19294  return NULL;
19295 }
19296 
19297 /* The occupancy of the table after the call will be about 50% */
19298 static UA_StatusCode
19299 expand(UA_NodeStore *ns) {
19300  UA_UInt32 osize = ns->size;
19301  UA_UInt32 count = ns->count;
19302  /* Resize only when table after removal of unused elements is either too
19303  full or too empty */
19304  if(count * 2 < osize && (count * 8 > osize || osize <= UA_NODESTORE_MINSIZE))
19305  return UA_STATUSCODE_GOOD;
19306 
19307  UA_NodeStoreEntry **oentries = ns->entries;
19308  UA_UInt32 nindex = higher_prime_index(count * 2);
19309  UA_UInt32 nsize = primes[nindex];
19310  UA_NodeStoreEntry **nentries = UA_calloc(nsize, sizeof(UA_NodeStoreEntry*));
19311  if(!nentries)
19313 
19314  ns->entries = nentries;
19315  ns->size = nsize;
19316  ns->sizePrimeIndex = nindex;
19317 
19318  /* recompute the position of every entry and insert the pointer */
19319  for(size_t i = 0, j = 0; i < osize && j < count; ++i) {
19320  if(oentries[i] <= UA_NODESTORE_TOMBSTONE)
19321  continue;
19322  UA_NodeStoreEntry **e = findSlot(ns, &oentries[i]->node.nodeId);
19323  UA_assert(e);
19324  *e = oentries[i];
19325  ++j;
19326  }
19327 
19328  UA_free(oentries);
19329  return UA_STATUSCODE_GOOD;
19330 }
19331 
19332 /**********************/
19333 /* Exported functions */
19334 /**********************/
19335 
19336 UA_NodeStore *
19338  UA_NodeStore *ns = UA_malloc(sizeof(UA_NodeStore));
19339  if(!ns)
19340  return NULL;
19341  ns->sizePrimeIndex = higher_prime_index(UA_NODESTORE_MINSIZE);
19342  ns->size = primes[ns->sizePrimeIndex];
19343  ns->count = 0;
19344  ns->entries = UA_calloc(ns->size, sizeof(UA_NodeStoreEntry*));
19345  if(!ns->entries) {
19346  UA_free(ns);
19347  return NULL;
19348  }
19349  return ns;
19350 }
19351 
19352 void
19354  UA_UInt32 size = ns->size;
19355  UA_NodeStoreEntry **entries = ns->entries;
19356  for(UA_UInt32 i = 0; i < size; ++i) {
19357  if(entries[i] > UA_NODESTORE_TOMBSTONE)
19358  deleteEntry(entries[i]);
19359  }
19360  UA_free(ns->entries);
19361  UA_free(ns);
19362 }
19363 
19364 UA_Node *
19366  UA_NodeStoreEntry *entry = instantiateEntry(nodeClass);
19367  if(!entry)
19368  return NULL;
19369  return &entry->node;
19370 }
19371 
19372 void
19373 UA_NodeStore_deleteNode(UA_Node *node) {
19374  UA_NodeStoreEntry *entry = container_of(node, UA_NodeStoreEntry, node);
19375  UA_assert(&entry->node == node);
19376  deleteEntry(entry);
19377 }
19378 
19380 UA_NodeStore_insert(UA_NodeStore *ns, UA_Node *node) {
19381  if(ns->size * 3 <= ns->count * 4) {
19382  if(expand(ns) != UA_STATUSCODE_GOOD)
19384  }
19385 
19386  UA_NodeId tempNodeid;
19387  tempNodeid = node->nodeId;
19388  tempNodeid.namespaceIndex = 0;
19389  UA_NodeStoreEntry **entry;
19390  if(UA_NodeId_isNull(&tempNodeid)) {
19391  /* create a random nodeid */
19392  if(node->nodeId.namespaceIndex == 0)
19393  node->nodeId.namespaceIndex = 1;
19394  UA_UInt32 identifier = ns->count+1; // start value
19395  UA_UInt32 size = ns->size;
19396  UA_UInt32 increase = mod2(identifier, size);
19397  while(true) {
19398  node->nodeId.identifier.numeric = identifier;
19399  entry = findSlot(ns, &node->nodeId);
19400  if(entry)
19401  break;
19402  identifier += increase;
19403  if(identifier >= size)
19404  identifier -= size;
19405  }
19406  } else {
19407  entry = findSlot(ns, &node->nodeId);
19408  if(!entry) {
19411  }
19412  }
19413 
19414  *entry = container_of(node, UA_NodeStoreEntry, node);
19415  ++ns->count;
19416  UA_assert(&(*entry)->node == node);
19417  return UA_STATUSCODE_GOOD;
19418 }
19419 
19421 UA_NodeStore_replace(UA_NodeStore *ns, UA_Node *node) {
19422  UA_NodeStoreEntry **entry = findNode(ns, &node->nodeId);
19423  if(!entry)
19425  UA_NodeStoreEntry *newEntry = container_of(node, UA_NodeStoreEntry, node);
19426  if(*entry != newEntry->orig) {
19427  // the node was replaced since the copy was made
19428  deleteEntry(newEntry);
19430  }
19431  deleteEntry(*entry);
19432  *entry = newEntry;
19433  return UA_STATUSCODE_GOOD;
19434 }
19435 
19436 const UA_Node *
19438  UA_NodeStoreEntry **entry = findNode(ns, nodeid);
19439  if(!entry)
19440  return NULL;
19441  return (const UA_Node*)&(*entry)->node;
19442 }
19443 
19444 UA_Node *
19446  UA_NodeStoreEntry **slot = findNode(ns, nodeid);
19447  if(!slot)
19448  return NULL;
19449  UA_NodeStoreEntry *entry = *slot;
19450  UA_NodeStoreEntry *new = instantiateEntry(entry->node.nodeClass);
19451  if(!new)
19452  return NULL;
19453  if(UA_Node_copyAnyNodeClass(&entry->node, &new->node) != UA_STATUSCODE_GOOD) {
19454  deleteEntry(new);
19455  return NULL;
19456  }
19457  new->orig = entry; // store the pointer to the original
19458  return &new->node;
19459 }
19460 
19463  UA_NodeStoreEntry **slot = findNode(ns, nodeid);
19464  if(!slot)
19466  deleteEntry(*slot);
19467  *slot = UA_NODESTORE_TOMBSTONE;
19468  --ns->count;
19469  /* Downsize the hashmap if it is very empty */
19470  if(ns->count * 8 < ns->size && ns->size > 32)
19471  expand(ns); // this can fail. we just continue with the bigger hashmap.
19472  return UA_STATUSCODE_GOOD;
19473 }
19474 
19475 void
19477  for(UA_UInt32 i = 0; i < ns->size; ++i) {
19478  if(ns->entries[i] > UA_NODESTORE_TOMBSTONE)
19479  visitor((UA_Node*)&ns->entries[i]->node);
19480  }
19481 }
19482 
19483 #endif /* UA_ENABLE_MULTITHREADING */
19484 
19485 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodestore_concurrent.c" ***********************************/
19486 
19487 /* This Source Code Form is subject to the terms of the Mozilla Public
19488 * License, v. 2.0. If a copy of the MPL was not distributed with this
19489 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19490 
19491 
19492 #ifdef UA_ENABLE_MULTITHREADING /* conditional compilation */
19493 #include <urcu/rculfhash.h>
19494 
19495 struct nodeEntry {
19496  struct cds_lfht_node htn;
19497  struct rcu_head rcu_head;
19498  struct nodeEntry *orig; //< the version this is a copy from (or NULL)
19499  UA_Node node;
19500 };
19501 
19502 static struct nodeEntry * instantiateEntry(UA_NodeClass class) {
19503  size_t size = sizeof(struct nodeEntry) - sizeof(UA_Node);
19504  switch(class) {
19505  case UA_NODECLASS_OBJECT:
19506  size += sizeof(UA_ObjectNode);
19507  break;
19508  case UA_NODECLASS_VARIABLE:
19509  size += sizeof(UA_VariableNode);
19510  break;
19511  case UA_NODECLASS_METHOD:
19512  size += sizeof(UA_MethodNode);
19513  break;
19515  size += sizeof(UA_ObjectTypeNode);
19516  break;
19518  size += sizeof(UA_VariableTypeNode);
19519  break;
19521  size += sizeof(UA_ReferenceTypeNode);
19522  break;
19523  case UA_NODECLASS_DATATYPE:
19524  size += sizeof(UA_DataTypeNode);
19525  break;
19526  case UA_NODECLASS_VIEW:
19527  size += sizeof(UA_ViewNode);
19528  break;
19529  default:
19530  return NULL;
19531  }
19532  struct nodeEntry *entry = UA_calloc(1, size);
19533  if(!entry)
19534  return NULL;
19535  entry->node.nodeClass = class;
19536  return entry;
19537 }
19538 
19539 static void deleteEntry(struct rcu_head *head) {
19540  struct nodeEntry *entry = container_of(head, struct nodeEntry, rcu_head);
19541  UA_Node_deleteMembersAnyNodeClass(&entry->node);
19542  UA_free(entry);
19543 }
19544 
19545 /* We are in a rcu_read lock. So the node will not be freed under our feet. */
19546 static int compare(struct cds_lfht_node *htn, const void *orig) {
19547  const UA_NodeId *origid = (const UA_NodeId *)orig;
19548  /* The htn is first in the entry structure. */
19549  const UA_NodeId *newid = &((struct nodeEntry *)htn)->node.nodeId;
19550  return UA_NodeId_equal(newid, origid);
19551 }
19552 
19554  /* 64 is the minimum size for the hashtable. */
19555  return (UA_NodeStore*)cds_lfht_new(64, 64, 0, CDS_LFHT_AUTO_RESIZE, NULL);
19556 }
19557 
19558 /* do not call with read-side critical section held!! */
19561  struct cds_lfht *ht = (struct cds_lfht*)ns;
19562  struct cds_lfht_iter iter;
19563  cds_lfht_first(ht, &iter);
19564  while(iter.node) {
19565  if(!cds_lfht_del(ht, iter.node)) {
19566  /* points to the htn entry, which is first */
19567  struct nodeEntry *entry = (struct nodeEntry*) iter.node;
19568  call_rcu(&entry->rcu_head, deleteEntry);
19569  }
19570  cds_lfht_next(ht, &iter);
19571  }
19572  UA_RCU_UNLOCK();
19573  cds_lfht_destroy(ht, NULL);
19574  UA_RCU_LOCK();
19575 }
19576 
19577 UA_Node * UA_NodeStore_newNode(UA_NodeClass class) {
19578  struct nodeEntry *entry = instantiateEntry(class);
19579  if(!entry)
19580  return NULL;
19581  return (UA_Node*)&entry->node;
19582 }
19583 
19584 void UA_NodeStore_deleteNode(UA_Node *node) {
19585  struct nodeEntry *entry = container_of(node, struct nodeEntry, node);
19586  deleteEntry(&entry->rcu_head);
19587 }
19588 
19589 UA_StatusCode UA_NodeStore_insert(UA_NodeStore *ns, UA_Node *node) {
19591  struct nodeEntry *entry = container_of(node, struct nodeEntry, node);
19592  struct cds_lfht *ht = (struct cds_lfht*)ns;
19593  cds_lfht_node_init(&entry->htn);
19594  struct cds_lfht_node *result;
19595  //namespace index is assumed to be valid
19596  UA_NodeId tempNodeid;
19597  tempNodeid = node->nodeId;
19598  tempNodeid.namespaceIndex = 0;
19599  if(!UA_NodeId_isNull(&tempNodeid)) {
19600  UA_UInt32 h = UA_NodeId_hash(&node->nodeId);
19601  result = cds_lfht_add_unique(ht, h, compare, &node->nodeId, &entry->htn);
19602  /* If the nodeid exists already */
19603  if(result != &entry->htn) {
19604  deleteEntry(&entry->rcu_head);
19606  }
19607  } else {
19608  /* create a unique nodeid */
19609  node->nodeId.identifierType = UA_NODEIDTYPE_NUMERIC;
19610  if(node->nodeId.namespaceIndex == 0) // original request for ns=0 should yield ns=1
19611  node->nodeId.namespaceIndex = 1;
19612 
19613  unsigned long identifier;
19614  long before, after;
19615  cds_lfht_count_nodes(ht, &before, &identifier, &after); // current number of nodes stored
19616  ++identifier;
19617 
19618  node->nodeId.identifier.numeric = (UA_UInt32)identifier;
19619  while(true) {
19620  UA_UInt32 h = UA_NodeId_hash(&node->nodeId);
19621  result = cds_lfht_add_unique(ht, h, compare, &node->nodeId, &entry->htn);
19622  if(result == &entry->htn)
19623  break;
19624  node->nodeId.identifier.numeric += (UA_UInt32)(identifier * 2654435761);
19625  }
19626  }
19627  return UA_STATUSCODE_GOOD;
19628 }
19629 
19630 UA_StatusCode UA_NodeStore_replace(UA_NodeStore *ns, UA_Node *node) {
19632  struct nodeEntry *entry = container_of(node, struct nodeEntry, node);
19633  struct cds_lfht *ht = (struct cds_lfht*)ns;
19634 
19635  /* Get the current version */
19636  UA_UInt32 h = UA_NodeId_hash(&node->nodeId);
19637  struct cds_lfht_iter iter;
19638  cds_lfht_lookup(ht, h, compare, &node->nodeId, &iter);
19639  if(!iter.node)
19641 
19642  /* We try to replace an obsolete version of the node */
19643  struct nodeEntry *oldEntry = (struct nodeEntry*)iter.node;
19644  if(oldEntry != entry->orig) {
19645  deleteEntry(&entry->rcu_head);
19647  }
19648 
19649  cds_lfht_node_init(&entry->htn);
19650  if(cds_lfht_replace(ht, &iter, h, compare, &node->nodeId, &entry->htn) != 0) {
19651  /* Replacing failed. Maybe the node got replaced just before this thread tried to.*/
19652  deleteEntry(&entry->rcu_head);
19654  }
19655 
19656  /* If an entry got replaced, mark it as dead. */
19657  call_rcu(&oldEntry->rcu_head, deleteEntry);
19658  return UA_STATUSCODE_GOOD;
19659 }
19660 
19663  struct cds_lfht *ht = (struct cds_lfht*)ns;
19664  UA_UInt32 h = UA_NodeId_hash(nodeid);
19665  struct cds_lfht_iter iter;
19666  cds_lfht_lookup(ht, h, compare, nodeid, &iter);
19667  if(!iter.node || cds_lfht_del(ht, iter.node) != 0)
19669  struct nodeEntry *entry = (struct nodeEntry*)iter.node;
19670  call_rcu(&entry->rcu_head, deleteEntry);
19671  return UA_STATUSCODE_GOOD;
19672 }
19673 
19674 const UA_Node * UA_NodeStore_get(UA_NodeStore *ns, const UA_NodeId *nodeid) {
19676  struct cds_lfht *ht = (struct cds_lfht*)ns;
19677  UA_UInt32 h = UA_NodeId_hash(nodeid);
19678  struct cds_lfht_iter iter;
19679  cds_lfht_lookup(ht, h, compare, nodeid, &iter);
19680  struct nodeEntry *found_entry = (struct nodeEntry*)iter.node;
19681  if(!found_entry)
19682  return NULL;
19683  return &found_entry->node;
19684 }
19685 
19686 UA_Node * UA_NodeStore_getCopy(UA_NodeStore *ns, const UA_NodeId *nodeid) {
19688  struct cds_lfht *ht = (struct cds_lfht*)ns;
19689  UA_UInt32 h = UA_NodeId_hash(nodeid);
19690  struct cds_lfht_iter iter;
19691  cds_lfht_lookup(ht, h, compare, nodeid, &iter);
19692  struct nodeEntry *entry = (struct nodeEntry*)iter.node;
19693  if(!entry)
19694  return NULL;
19695  struct nodeEntry *new = instantiateEntry(entry->node.nodeClass);
19696  if(!new)
19697  return NULL;
19698  if(UA_Node_copyAnyNodeClass(&entry->node, &new->node) != UA_STATUSCODE_GOOD) {
19699  deleteEntry(&new->rcu_head);
19700  return NULL;
19701  }
19702  new->orig = entry;
19703  return &new->node;
19704 }
19705 
19708  struct cds_lfht *ht = (struct cds_lfht*)ns;
19709  struct cds_lfht_iter iter;
19710  cds_lfht_first(ht, &iter);
19711  while(iter.node != NULL) {
19712  struct nodeEntry *found_entry = (struct nodeEntry*)iter.node;
19713  visitor(&found_entry->node);
19714  cds_lfht_next(ht, &iter);
19715  }
19716 }
19717 
19718 #endif /* UA_ENABLE_MULTITHREADING */
19719 
19720 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_discovery.c" ***********************************/
19721 
19722 /* This Source Code Form is subject to the terms of the Mozilla Public
19723 * License, v. 2.0. If a copy of the MPL was not distributed with this
19724 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19725 
19726 
19727 void Service_FindServers(UA_Server *server, UA_Session *session,
19728  const UA_FindServersRequest *request, UA_FindServersResponse *response) {
19729  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing FindServersRequest");
19730  /* copy ApplicationDescription from the config */
19732  if(!descr) {
19734  return;
19735  }
19736  response->responseHeader.serviceResult =
19737  UA_ApplicationDescription_copy(&server->config.applicationDescription, descr);
19739  UA_free(descr);
19740  return;
19741  }
19742 
19743  /* add the discoveryUrls from the networklayers */
19744  UA_String *disc = UA_realloc(descr->discoveryUrls, sizeof(UA_String) *
19745  (descr->discoveryUrlsSize + server->config.networkLayersSize));
19746  if(!disc) {
19748  UA_ApplicationDescription_delete(descr);
19749  return;
19750  }
19751  size_t existing = descr->discoveryUrlsSize;
19752  descr->discoveryUrls = disc;
19753  descr->discoveryUrlsSize += server->config.networkLayersSize;
19754 
19755  // TODO: Add nl only if discoveryUrl not already present
19756  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
19757  UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
19758  UA_String_copy(&nl->discoveryUrl, &descr->discoveryUrls[existing + i]);
19759  }
19760 
19761  response->servers = descr;
19762  response->serversSize = 1;
19763 }
19764 
19765 void Service_GetEndpoints(UA_Server *server, UA_Session *session, const UA_GetEndpointsRequest *request,
19766  UA_GetEndpointsResponse *response) {
19767  /* If the client expects to see a specific endpointurl, mirror it back. If
19768  not, clone the endpoints with the discovery url of all networklayers. */
19769  const UA_String *endpointUrl = &request->endpointUrl;
19770  if(endpointUrl->length > 0) {
19771  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing GetEndpointsRequest with endpointUrl " \
19773  } else {
19774  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing GetEndpointsRequest with an empty endpointUrl");
19775  }
19776 
19777  /* test if the supported binary profile shall be returned */
19778 #ifdef NO_ALLOCA
19779  UA_Boolean relevant_endpoints[server->endpointDescriptionsSize];
19780 #else
19781  UA_Boolean *relevant_endpoints = UA_alloca(sizeof(UA_Boolean) * server->endpointDescriptionsSize);
19782 #endif
19783  memset(relevant_endpoints, 0, sizeof(UA_Boolean) * server->endpointDescriptionsSize);
19784  size_t relevant_count = 0;
19785  if(request->profileUrisSize == 0) {
19786  for(size_t j = 0; j < server->endpointDescriptionsSize; ++j)
19787  relevant_endpoints[j] = true;
19788  relevant_count = server->endpointDescriptionsSize;
19789  } else {
19790  for(size_t j = 0; j < server->endpointDescriptionsSize; ++j) {
19791  for(size_t i = 0; i < request->profileUrisSize; ++i) {
19793  continue;
19794  relevant_endpoints[j] = true;
19795  ++relevant_count;
19796  break;
19797  }
19798  }
19799  }
19800 
19801  if(relevant_count == 0) {
19802  response->endpointsSize = 0;
19803  return;
19804  }
19805 
19806  /* Clone the endpoint for each networklayer? */
19807  size_t clone_times = 1;
19808  UA_Boolean nl_endpointurl = false;
19809  if(endpointUrl->length == 0) {
19810  clone_times = server->config.networkLayersSize;
19811  nl_endpointurl = true;
19812  }
19813 
19814  response->endpoints = UA_Array_new(relevant_count * clone_times, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
19815  if(!response->endpoints) {
19817  return;
19818  }
19819  response->endpointsSize = relevant_count * clone_times;
19820 
19821  size_t k = 0;
19823  for(size_t i = 0; i < clone_times; ++i) {
19824  if(nl_endpointurl)
19825  endpointUrl = &server->config.networkLayers[i].discoveryUrl;
19826  for(size_t j = 0; j < server->endpointDescriptionsSize; ++j) {
19827  if(!relevant_endpoints[j])
19828  continue;
19829  retval |= UA_EndpointDescription_copy(&server->endpointDescriptions[j], &response->endpoints[k]);
19830  retval |= UA_String_copy(endpointUrl, &response->endpoints[k].endpointUrl);
19831  ++k;
19832  }
19833  }
19834 
19835  if(retval != UA_STATUSCODE_GOOD) {
19836  response->responseHeader.serviceResult = retval;
19837  UA_Array_delete(response->endpoints, response->endpointsSize, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
19838  response->endpoints = NULL;
19839  response->endpointsSize = 0;
19840  return;
19841  }
19842 }
19843 
19844 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_securechannel.c" ***********************************/
19845 
19846 /* This Source Code Form is subject to the terms of the Mozilla Public
19847 * License, v. 2.0. If a copy of the MPL was not distributed with this
19848 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19849 
19850 
19851 void Service_OpenSecureChannel(UA_Server *server, UA_Connection *connection,
19852  const UA_OpenSecureChannelRequest *request,
19853  UA_OpenSecureChannelResponse *response) {
19854  // todo: if(request->clientProtocolVersion != protocolVersion)
19856  response->responseHeader.serviceResult =
19857  UA_SecureChannelManager_open(&server->secureChannelManager, connection, request, response);
19858 
19860  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
19861  "Connection %i | SecureChannel %i | OpenSecureChannel: Opened SecureChannel",
19862  connection->sockfd, response->securityToken.channelId);
19863  } else {
19864  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
19865  "Connection %i | OpenSecureChannel: Opening a SecureChannel failed",
19866  connection->sockfd);
19867  }
19868  } else {
19869  response->responseHeader.serviceResult =
19870  UA_SecureChannelManager_renew(&server->secureChannelManager, connection, request, response);
19871 
19873  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
19874  "Connection %i | SecureChannel %i | OpenSecureChannel: SecureChannel renewed",
19875  connection->sockfd, response->securityToken.channelId);
19876  } else {
19877  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
19878  "Connection %i | OpenSecureChannel: Renewing SecureChannel failed",
19879  connection->sockfd);
19880  }
19881  }
19882 }
19883 
19884 /* The server does not send a CloseSecureChannel response */
19885 void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel) {
19886  UA_LOG_INFO_CHANNEL(server->config.logger, channel, "CloseSecureChannel");
19888 }
19889 
19890 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_session.c" ***********************************/
19891 
19892 /* This Source Code Form is subject to the terms of the Mozilla Public
19893 * License, v. 2.0. If a copy of the MPL was not distributed with this
19894 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19895 
19896 
19897 void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
19898  const UA_CreateSessionRequest *request,
19899  UA_CreateSessionResponse *response) {
19900  if(channel->securityToken.channelId == 0) {
19902  return;
19903  }
19904 
19905  /* Copy the server's endpoint into the response */
19906  response->responseHeader.serviceResult =
19908  (void**)&response->serverEndpoints, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
19910  return;
19911  response->serverEndpointsSize = server->endpointDescriptionsSize;
19912 
19913  /* Mirror back the endpointUrl */
19914  for(size_t i = 0; i < response->serverEndpointsSize; ++i)
19915  UA_String_copy(&request->endpointUrl, &response->serverEndpoints[i].endpointUrl);
19916 
19917  UA_Session *newSession;
19918  response->responseHeader.serviceResult =
19919  UA_SessionManager_createSession(&server->sessionManager, channel, request, &newSession);
19921  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel, "Processing CreateSessionRequest failed");
19922  return;
19923  }
19924 
19925  newSession->maxResponseMessageSize = request->maxResponseMessageSize;
19926  newSession->maxRequestMessageSize = channel->connection->localConf.maxMessageSize;
19927  response->sessionId = newSession->sessionId;
19928  response->revisedSessionTimeout = (UA_Double)newSession->timeout;
19929  response->authenticationToken = newSession->authenticationToken;
19930  response->responseHeader.serviceResult = UA_String_copy(&request->sessionName, &newSession->sessionName);
19931  if(server->endpointDescriptionsSize > 0)
19932  response->responseHeader.serviceResult |=
19933  UA_ByteString_copy(&server->endpointDescriptions->serverCertificate,
19934  &response->serverCertificate);
19937  return;
19938  }
19939  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel, "Session " UA_PRINTF_GUID_FORMAT " created",
19941 }
19942 
19943 void
19944 Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel,
19945  UA_Session *session, const UA_ActivateSessionRequest *request,
19946  UA_ActivateSessionResponse *response) {
19947  if(session->validTill < UA_DateTime_nowMonotonic()) {
19948  UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: SecureChannel %i wants "
19949  "to activate, but the session has timed out", channel->securityToken.channelId);
19951  return;
19952  }
19953 
19957  UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: SecureChannel %i wants "
19958  "to activate, but the UserIdentify token is invalid", channel->securityToken.channelId);
19960  return;
19961  }
19962 
19963 
19964  UA_String ap = UA_STRING(ANONYMOUS_POLICY);
19965  UA_String up = UA_STRING(USERNAME_POLICY);
19966 
19967  /* Compatibility notice: Siemens OPC Scout v10 provides an empty policyId,
19968  this is not okay For compatibility we will assume that empty policyId == ANONYMOUS_POLICY
19969  if(token.policyId->data == NULL)
19970  response->responseHeader.serviceResult = UA_STATUSCODE_BADIDENTITYTOKENINVALID;
19971  */
19972 
19973  if(server->config.enableAnonymousLogin &&
19975  /* anonymous login */
19976  const UA_AnonymousIdentityToken *token = request->userIdentityToken.content.decoded.data;
19977  if(token->policyId.data && !UA_String_equal(&token->policyId, &ap)) {
19979  return;
19980  }
19981  } else if(server->config.enableUsernamePasswordLogin &&
19982  request->userIdentityToken.content.decoded.type == &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN]) {
19983  /* username login */
19984  const UA_UserNameIdentityToken *token = request->userIdentityToken.content.decoded.data;
19985  if(!UA_String_equal(&token->policyId, &up)) {
19987  return;
19988  }
19989  if(token->encryptionAlgorithm.length > 0) {
19990  /* we don't support encryption */
19992  return;
19993  }
19994 
19995  if(token->userName.length == 0 && token->password.length == 0) {
19996  /* empty username and password */
19998  return;
19999  }
20000 
20001  /* trying to match pw/username */
20002  UA_Boolean match = false;
20003  for(size_t i = 0; i < server->config.usernamePasswordLoginsSize; ++i) {
20004  UA_String *user = &server->config.usernamePasswordLogins[i].username;
20005  UA_String *pw = &server->config.usernamePasswordLogins[i].password;
20006  if(UA_String_equal(&token->userName, user) && UA_String_equal(&token->password, pw)) {
20007  match = true;
20008  break;
20009  }
20010  }
20011  if(!match) {
20012  UA_LOG_INFO_SESSION(server->config.logger, session,
20013  "ActivateSession: Did not find matching username/password");
20015  return;
20016  }
20017  } else {
20018  /* Unsupported token type */
20020  return;
20021  }
20022 
20023  /* Detach the old SecureChannel */
20024  if(session->channel && session->channel != channel) {
20025  UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: Detach from old channel");
20026  UA_SecureChannel_detachSession(session->channel, session);
20027  }
20028 
20029  /* Attach to the SecureChannel and activate */
20030  UA_SecureChannel_attachSession(channel, session);
20031  session->activated = true;
20032  UA_Session_updateLifetime(session);
20033  UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: Session activated");
20034 }
20035 
20036 void
20037 Service_CloseSession(UA_Server *server, UA_Session *session, const UA_CloseSessionRequest *request,
20038  UA_CloseSessionResponse *response) {
20039  UA_LOG_INFO_SESSION(server->config.logger, session, "CloseSession");
20040  response->responseHeader.serviceResult =
20042 }
20043 
20044 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_attribute.c" ***********************************/
20045 
20046 /* This Source Code Form is subject to the terms of the Mozilla Public
20047 * License, v. 2.0. If a copy of the MPL was not distributed with this
20048 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
20049 
20050 #ifdef UA_ENABLE_NONSTANDARD_STATELESS
20051 #endif
20052 
20053 /* Force cast from const data for zero-copy reading. The storage type is set to
20054  nodelete. So the value is not deleted. Use with care! */
20055 static void
20056 forceVariantSetScalar(UA_Variant *v, const void *p, const UA_DataType *t) {
20057  UA_Variant_init(v);
20058  v->type = t;
20059  v->data = (void*)(uintptr_t)p;
20061 }
20062 
20063 /*****************/
20064 /* Type Checking */
20065 /*****************/
20066 
20071 };
20072 
20073 static enum type_equivalence
20074 typeEquivalence(const UA_DataType *t) {
20075  if(t->membersSize != 1 || !t->members[0].namespaceZero)
20076  return TYPE_EQUIVALENCE_NONE;
20078  return TYPE_EQUIVALENCE_ENUM;
20079  if(t->members[0].memberTypeIndex == UA_TYPES_BYTE && t->members[0].isArray)
20080  return TYPE_EQUIVALENCE_OPAQUE;
20081  return TYPE_EQUIVALENCE_NONE;
20082 }
20083 
20084 /* Test whether a valurank and the given arraydimensions are compatible. zero
20085  * array dimensions indicate a scalar */
20086 static UA_StatusCode
20087 compatibleValueRankArrayDimensions(UA_Int32 valueRank, size_t arrayDimensionsSize) {
20088  switch(valueRank) {
20089  case -3: /* the value can be a scalar or a one dimensional array */
20090  if(arrayDimensionsSize > 1)
20092  break;
20093  case -2: /* the value can be a scalar or an array with any number of dimensions */
20094  break;
20095  case -1: /* the value is a scalar */
20096  if(arrayDimensionsSize > 0)
20098  break;
20099  case 0: /* the value is an array with one or more dimensions */
20100  if(arrayDimensionsSize < 1)
20102  break;
20103  default: /* >= 1: the value is an array with the specified number of dimensions */
20104  if(valueRank < 0)
20106  /* Must hold if the array has a defined length. Null arrays (length -1)
20107  * need to be caught before. */
20108  if(arrayDimensionsSize != (size_t)valueRank)
20110  }
20111  return UA_STATUSCODE_GOOD;
20112 }
20113 
20114 /* Check if the valuerank allows for the value dimension */
20115 static UA_StatusCode
20116 compatibleValueRankValue(UA_Int32 valueRank, const UA_Variant *value) {
20117  /* empty arrays (-1) always match */
20118  if(value->data == NULL)
20119  return UA_STATUSCODE_GOOD;
20120 
20121  size_t arrayDims = value->arrayDimensionsSize;
20122  if(!UA_Variant_isScalar(value))
20123  arrayDims = 1; /* array but no arraydimensions -> implicit array dimension 1 */
20124  return compatibleValueRankArrayDimensions(valueRank, arrayDims);
20125 }
20126 
20128 compatibleArrayDimensions(size_t constraintArrayDimensionsSize,
20129  const UA_UInt32 *constraintArrayDimensions,
20130  size_t testArrayDimensionsSize,
20131  const UA_UInt32 *testArrayDimensions) {
20132  /* No array dimensions defined -> everything is permitted if the value rank fits */
20133  if(constraintArrayDimensionsSize == 0) {
20134  return UA_STATUSCODE_GOOD;
20135  }
20136 
20137  /* Dimension count must match */
20138  if(testArrayDimensionsSize != constraintArrayDimensionsSize)
20140 
20141  /* Dimension lengths must match; zero in the constraint is a wildcard */
20142  for(size_t i = 0; i < constraintArrayDimensionsSize; ++i) {
20143  if(constraintArrayDimensions[i] != testArrayDimensions[i] &&
20144  constraintArrayDimensions[i] != 0)
20146  }
20147  return UA_STATUSCODE_GOOD;
20148 }
20149 
20150 /* Returns the pointer to a datavalue with a possibly transformed type to match
20151  the description */
20152 static const UA_Variant *
20153 convertToMatchingValue(UA_Server *server, const UA_Variant *value,
20154  const UA_NodeId *targetDataTypeId, UA_Variant *editableValue) {
20155  const UA_DataType *targetDataType = UA_findDataType(targetDataTypeId);
20156  if(!targetDataType)
20157  return NULL;
20158 
20159  /* A string is written to a byte array. the valuerank and array
20160  dimensions are checked later */
20161  if(targetDataType == &UA_TYPES[UA_TYPES_BYTE] &&
20162  value->type == &UA_TYPES[UA_TYPES_BYTESTRING] &&
20163  UA_Variant_isScalar(value)) {
20164  UA_ByteString *str = (UA_ByteString*)value->data;
20165  editableValue->storageType = UA_VARIANT_DATA_NODELETE;
20166  editableValue->type = &UA_TYPES[UA_TYPES_BYTE];
20167  editableValue->arrayLength = str->length;
20168  editableValue->data = str->data;
20169  return editableValue;
20170  }
20171 
20172  /* An enum was sent as an int32, or an opaque type as a bytestring. This
20173  * is detected with the typeIndex indicating the "true" datatype. */
20174  enum type_equivalence te1 = typeEquivalence(targetDataType);
20175  enum type_equivalence te2 = typeEquivalence(value->type);
20176  if(te1 != TYPE_EQUIVALENCE_NONE && te1 == te2) {
20177  *editableValue = *value;
20178  editableValue->storageType = UA_VARIANT_DATA_NODELETE;
20179  editableValue->type = targetDataType;
20180  return editableValue;
20181  }
20182 
20183  /* No more possible equivalencies */
20184  return NULL;
20185 }
20186 
20187 /* Test whether the value matches a variable definition given by
20188  * - datatype
20189  * - valueranke
20190  * - array dimensions.
20191  * Sometimes it can be necessary to transform the content of the value, e.g.
20192  * byte array to bytestring or uint32 to some enum. If editableValue is non-NULL,
20193  * we try to create a matching variant that points to the original data. */
20195 typeCheckValue(UA_Server *server, const UA_NodeId *targetDataTypeId,
20196  UA_Int32 targetValueRank, size_t targetArrayDimensionsSize,
20197  const UA_UInt32 *targetArrayDimensions, const UA_Variant *value,
20198  const UA_NumericRange *range, UA_Variant *editableValue) {
20199  /* Empty variant is only allowed for BaseDataType */
20200  if(!value->type)
20201  goto check_array;
20202 
20203  /* See if the types match. The nodeid on the wire may be != the nodeid in
20204  * the node for opaque types, enums and bytestrings. value contains the
20205  * correct type definition after the following paragraph */
20206  if(UA_NodeId_equal(&value->type->typeId, targetDataTypeId))
20207  goto check_array;
20208 
20209  /* Has the value a subtype of the required type? */
20210  const UA_NodeId subtypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
20211  if(isNodeInTree(server->nodestore, &value->type->typeId, targetDataTypeId, &subtypeId, 1))
20212  goto check_array;
20213 
20214  /* Try to convert to a matching value if this is wanted */
20215  if(!editableValue)
20217  value = convertToMatchingValue(server, value, targetDataTypeId, editableValue);
20218  if(!value)
20220 
20221  check_array:
20222  if(range) /* array dimensions are checked later when writing the range */
20223  return UA_STATUSCODE_GOOD;
20224 
20225  size_t valueArrayDimensionsSize = value->arrayDimensionsSize;
20226  UA_UInt32 *valueArrayDimensions = value->arrayDimensions;
20227  UA_UInt32 tempArrayDimensions;
20228  if(valueArrayDimensions == 0 && !UA_Variant_isScalar(value)) {
20229  valueArrayDimensionsSize = 1;
20230  tempArrayDimensions = (UA_UInt32)value->arrayLength;
20231  valueArrayDimensions = &tempArrayDimensions;
20232  }
20233 
20234  /* See if the array dimensions match. When arrayDimensions are defined, they
20235  * already hold the valuerank. */
20236  if(targetArrayDimensionsSize > 0)
20237  return compatibleArrayDimensions(targetArrayDimensionsSize, targetArrayDimensions,
20238  valueArrayDimensionsSize, valueArrayDimensions);
20239 
20240  /* Check if the valuerank allows for the value dimension */
20241  return compatibleValueRankValue(targetValueRank, value);
20242 }
20243 
20244 /*****************************/
20245 /* ArrayDimensions Attribute */
20246 /*****************************/
20247 
20248 static UA_StatusCode
20249 readArrayDimensionsAttribute(const UA_VariableNode *vn, UA_DataValue *v) {
20250  UA_Variant_setArray(&v->value, vn->arrayDimensions,
20251  vn->arrayDimensionsSize, &UA_TYPES[UA_TYPES_UINT32]);
20253  v->hasValue = true;
20254  return UA_STATUSCODE_GOOD;
20255 }
20256 
20257 static UA_StatusCode
20258 writeArrayDimensionsAttribute(UA_Server *server, UA_VariableNode *node,
20259  size_t arrayDimensionsSize, UA_UInt32 *arrayDimensions) {
20260  /* If this is a variabletype, there must be no instances or subtypes of it
20261  * when we do the change */
20262  if(node->nodeClass == UA_NODECLASS_VARIABLETYPE &&
20263  UA_Node_hasSubTypeOrInstances((const UA_Node*)node))
20265 
20266  /* Check that the array dimensions match with the valuerank */
20267  UA_StatusCode retval = compatibleValueRankArrayDimensions(node->valueRank, arrayDimensionsSize);
20268  if(retval != UA_STATUSCODE_GOOD) {
20269  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
20270  "The current value rank does not match the new array dimensions");
20271  return retval;
20272  }
20273 
20274  /* Get the VariableType */
20275  const UA_VariableTypeNode *vt = getVariableNodeType(server, (UA_VariableNode*)node);
20276  if(!vt)
20278 
20279  /* Check if the array dimensions match with the wildcards in the
20280  * variabletype (dimension length 0) */
20281  if(vt->arrayDimensions) {
20282  retval = compatibleArrayDimensions(vt->arrayDimensionsSize, vt->arrayDimensions,
20283  arrayDimensionsSize, arrayDimensions);
20284  if(retval != UA_STATUSCODE_GOOD) {
20285  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
20286  "Array dimensions in the variable type do not match");
20287  return retval;
20288  }
20289  }
20290 
20291  /* Check if the current value is compatible with the array dimensions */
20292  UA_DataValue value;
20293  UA_DataValue_init(&value);
20294  retval = readValueAttribute(server, node, &value);
20295  if(retval != UA_STATUSCODE_GOOD)
20296  return retval;
20297  if(value.hasValue) {
20298  retval = compatibleArrayDimensions(arrayDimensionsSize, arrayDimensions,
20299  value.value.arrayDimensionsSize,
20300  value.value.arrayDimensions);
20301  UA_DataValue_deleteMembers(&value);
20302  if(retval != UA_STATUSCODE_GOOD) {
20303  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
20304  "Array dimensions in the current value do not match");
20305  return retval;
20306  }
20307  }
20308 
20309  /* Ok, apply */
20310  UA_UInt32 *oldArrayDimensions = node->arrayDimensions;
20311  retval = UA_Array_copy(arrayDimensions, arrayDimensionsSize,
20312  (void**)&node->arrayDimensions, &UA_TYPES[UA_TYPES_UINT32]);
20313  if(retval != UA_STATUSCODE_GOOD)
20314  return retval;
20315  UA_free(oldArrayDimensions);
20316  node->arrayDimensionsSize = arrayDimensionsSize;
20317  return UA_STATUSCODE_GOOD;
20318 }
20319 
20320 /***********************/
20321 /* ValueRank Attribute */
20322 /***********************/
20323 
20324 static UA_StatusCode
20325 writeValueRankAttributeWithVT(UA_Server *server, UA_VariableNode *node,
20326  UA_Int32 valueRank) {
20327  const UA_VariableTypeNode *vt = getVariableNodeType(server, node);
20328  if(!vt)
20330  return writeValueRankAttribute(server, node, valueRank, vt->valueRank);
20331 }
20332 
20334 writeValueRankAttribute(UA_Server *server, UA_VariableNode *node, UA_Int32 valueRank,
20335  UA_Int32 constraintValueRank) {
20336  /* If this is a variabletype, there must be no instances or subtypes of it
20337  when we do the change */
20338  if(node->nodeClass == UA_NODECLASS_VARIABLETYPE &&
20339  UA_Node_hasSubTypeOrInstances((const UA_Node*)node))
20341 
20342  /* Check if the valuerank of the variabletype allows the change. */
20343  switch(constraintValueRank) {
20344  case -3: /* the value can be a scalar or a one dimensional array */
20345  if(valueRank != -1 && valueRank != 1)
20347  break;
20348  case -2: /* the value can be a scalar or an array with any number of dimensions */
20349  break;
20350  case -1: /* the value is a scalar */
20351  if(valueRank != -1)
20353  break;
20354  case 0: /* the value is an array with one or more dimensions */
20355  if(valueRank < 0)
20357  break;
20358  default: /* >= 1: the value is an array with the specified number of dimensions */
20359  if(valueRank != constraintValueRank)
20361  break;
20362  }
20363 
20364  /* Check if the new valuerank is compatible with the array dimensions. Use
20365  * the read service to handle data sources. */
20366  size_t arrayDims = node->arrayDimensionsSize;
20368  if(arrayDims == 0) {
20369  /* the value could be an array with no arrayDimensions defined.
20370  dimensions zero indicate a scalar for compatibleValueRankArrayDimensions. */
20371  UA_DataValue value;
20372  UA_DataValue_init(&value);
20373  retval = readValueAttribute(server, node, &value);
20374  if(retval != UA_STATUSCODE_GOOD)
20375  return retval;
20376  if(!value.hasValue || value.value.data == NULL)
20377  goto apply; /* no value or null array */
20378  if(!UA_Variant_isScalar(&value.value))
20379  arrayDims = 1;
20380  UA_DataValue_deleteMembers(&value);
20381  }
20382  retval = compatibleValueRankArrayDimensions(valueRank, arrayDims);
20383  if(retval != UA_STATUSCODE_GOOD)
20384  return retval;
20385 
20386  /* All good, apply the change */
20387  apply:
20388  node->valueRank = valueRank;
20389  return UA_STATUSCODE_GOOD;
20390 }
20391 
20392 /**********************/
20393 /* DataType Attribute */
20394 /**********************/
20395 
20396 static UA_StatusCode
20397 writeDataTypeAttributeWithVT(UA_Server *server, UA_VariableNode *node,
20398  const UA_NodeId *dataType) {
20399  const UA_VariableTypeNode *vt = getVariableNodeType(server, node);
20400  if(!vt)
20402  return writeDataTypeAttribute(server, node, dataType, &vt->dataType);
20403 }
20404 
20405 /* constraintDataType can be NULL, then we retrieve the vt */
20407 writeDataTypeAttribute(UA_Server *server, UA_VariableNode *node,
20408  const UA_NodeId *dataType, const UA_NodeId *constraintDataType) {
20409  /* If this is a variabletype, there must be no instances or subtypes of it
20410  when we do the change */
20411  if(node->nodeClass == UA_NODECLASS_VARIABLETYPE &&
20412  UA_Node_hasSubTypeOrInstances((const UA_Node*)node))
20414 
20415  /* Does the new type match the constraints of the variabletype? */
20416  UA_NodeId subtypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
20417  if(!isNodeInTree(server->nodestore, dataType,
20418  constraintDataType, &subtypeId, 1))
20420 
20421  /* Check if the current value would match the new type */
20422  UA_DataValue value;
20423  UA_DataValue_init(&value);
20424  UA_StatusCode retval = readValueAttribute(server, node, &value);
20425  if(retval != UA_STATUSCODE_GOOD)
20426  return retval;
20427  if(value.hasValue) {
20428  retval = typeCheckValue(server, dataType, node->valueRank,
20429  node->arrayDimensionsSize, node->arrayDimensions,
20430  &value.value, NULL, NULL);
20431  UA_DataValue_deleteMembers(&value);
20432  if(retval != UA_STATUSCODE_GOOD) {
20433  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
20434  "The current value does not match the new data type");
20435  return retval;
20436  }
20437  }
20438 
20439  /* Replace the datatype nodeid */
20440  UA_NodeId dtCopy = node->dataType;
20441  retval = UA_NodeId_copy(dataType, &node->dataType);
20442  if(retval != UA_STATUSCODE_GOOD) {
20443  node->dataType = dtCopy;
20444  return retval;
20445  }
20446  UA_NodeId_deleteMembers(&dtCopy);
20447  return UA_STATUSCODE_GOOD;
20448 }
20449 
20450 /*******************/
20451 /* Value Attribute */
20452 /*******************/
20453 
20454 static UA_StatusCode
20455 readValueAttributeFromNode(UA_Server *server, const UA_VariableNode *vn, UA_DataValue *v,
20456  UA_NumericRange *rangeptr) {
20457  if(vn->value.data.callback.onRead) {
20458  UA_RCU_UNLOCK();
20459  vn->value.data.callback.onRead(vn->value.data.callback.handle,
20460  vn->nodeId, &vn->value.data.value.value, rangeptr);
20461  UA_RCU_LOCK();
20462 #ifdef UA_ENABLE_MULTITHREADING
20463  /* Reopen the node to see the changes (multithreading only) */
20464  vn = (const UA_VariableNode*)UA_NodeStore_get(server->nodestore, &vn->nodeId);
20465 #endif
20466  }
20467  if(rangeptr)
20468  return UA_Variant_copyRange(&vn->value.data.value.value, &v->value, *rangeptr);
20469  *v = vn->value.data.value;
20471  return UA_STATUSCODE_GOOD;
20472 }
20473 
20474 static UA_StatusCode
20475 readValueAttributeFromDataSource(const UA_VariableNode *vn, UA_DataValue *v,
20476  UA_TimestampsToReturn timestamps,
20477  UA_NumericRange *rangeptr) {
20478  if(!vn->value.dataSource.read)
20480  UA_Boolean sourceTimeStamp = (timestamps == UA_TIMESTAMPSTORETURN_SOURCE ||
20481  timestamps == UA_TIMESTAMPSTORETURN_BOTH);
20482 
20483  UA_RCU_UNLOCK();
20484  UA_StatusCode retval =
20485  vn->value.dataSource.read(vn->value.dataSource.handle, vn->nodeId,
20486  sourceTimeStamp, rangeptr, v);
20487  UA_RCU_LOCK();
20488  return retval;
20489 }
20490 
20491 static UA_StatusCode
20492 readValueAttributeComplete(UA_Server *server, const UA_VariableNode *vn,
20493  UA_TimestampsToReturn timestamps, const UA_String *indexRange,
20494  UA_DataValue *v) {
20495  /* Compute the index range */
20496  UA_NumericRange range;
20497  UA_NumericRange *rangeptr = NULL;
20499  if(indexRange && indexRange->length > 0) {
20500  retval = parse_numericrange(indexRange, &range);
20501  if(retval != UA_STATUSCODE_GOOD)
20502  return retval;
20503  rangeptr = &range;
20504  }
20505 
20506  /* Read the value */
20507  if(vn->valueSource == UA_VALUESOURCE_DATA)
20508  retval = readValueAttributeFromNode(server, vn, v, rangeptr);
20509  else
20510  retval = readValueAttributeFromDataSource(vn, v, timestamps, rangeptr);
20511 
20512  /* Clean up */
20513  if(rangeptr)
20514  UA_free(range.dimensions);
20515  return retval;
20516 }
20517 
20519 readValueAttribute(UA_Server *server, const UA_VariableNode *vn, UA_DataValue *v) {
20520  return readValueAttributeComplete(server, vn, UA_TIMESTAMPSTORETURN_NEITHER, NULL, v);
20521 }
20522 
20523 static UA_StatusCode
20524 writeValueAttributeWithoutRange(UA_VariableNode *node, const UA_DataValue *value) {
20525  UA_DataValue old_value = node->value.data.value; /* keep the pointers for restoring */
20526  UA_StatusCode retval = UA_DataValue_copy(value, &node->value.data.value);
20527  if(retval == UA_STATUSCODE_GOOD)
20528  UA_DataValue_deleteMembers(&old_value);
20529  else
20530  node->value.data.value = old_value;
20531  return retval;
20532 }
20533 
20534 static UA_StatusCode
20535 writeValueAttributeWithRange(UA_VariableNode *node, const UA_DataValue *value,
20536  const UA_NumericRange *rangeptr) {
20537  /* Value on both sides? */
20538  if(value->status != node->value.data.value.status ||
20539  !value->hasValue || !node->value.data.value.hasValue)
20541 
20542  /* Make scalar a one-entry array for range matching */
20543  UA_Variant editableValue;
20544  const UA_Variant *v = &value->value;
20545  if(UA_Variant_isScalar(&value->value)) {
20546  editableValue = value->value;
20547  editableValue.arrayLength = 1;
20548  v = &editableValue;
20549  }
20550 
20551  /* Write the value */
20552  UA_StatusCode retval = UA_Variant_setRangeCopy(&node->value.data.value.value,
20553  v->data, v->arrayLength, *rangeptr);
20554  if(retval != UA_STATUSCODE_GOOD)
20555  return retval;
20556 
20557  /* Write the status and timestamps */
20558  node->value.data.value.hasStatus = value->hasStatus;
20559  node->value.data.value.status = value->status;
20560  node->value.data.value.hasSourceTimestamp = value->hasSourceTimestamp;
20561  node->value.data.value.sourceTimestamp = value->sourceTimestamp;
20562  node->value.data.value.hasSourcePicoseconds = value->hasSourcePicoseconds;
20563  node->value.data.value.sourcePicoseconds = value->sourcePicoseconds;
20564  return UA_STATUSCODE_GOOD;
20565 }
20566 
20568 writeValueAttribute(UA_Server *server, UA_VariableNode *node,
20569  const UA_DataValue *value, const UA_String *indexRange) {
20570  /* Parse the range */
20571  UA_NumericRange range;
20572  UA_NumericRange *rangeptr = NULL;
20574  if(indexRange && indexRange->length > 0) {
20575  retval = parse_numericrange(indexRange, &range);
20576  if(retval != UA_STATUSCODE_GOOD)
20577  return retval;
20578  rangeptr = &range;
20579  }
20580 
20581  /* Copy the value into an editable "container" where e.g. the datatype can
20582  * be adjusted. The data itself is not written into. */
20583  UA_DataValue editableValue = *value;
20584  editableValue.value.storageType = UA_VARIANT_DATA_NODELETE;
20585 
20586  /* Type checking. May change the type of editableValue */
20587  if(value->hasValue) {
20588  retval = typeCheckValue(server, &node->dataType, node->valueRank,
20589  node->arrayDimensionsSize, node->arrayDimensions,
20590  &value->value, rangeptr, &editableValue.value);
20591  if(retval != UA_STATUSCODE_GOOD)
20592  goto cleanup;
20593  }
20594 
20595  /* Set the source timestamp if there is none */
20596  if(!editableValue.hasSourceTimestamp) {
20597  editableValue.sourceTimestamp = UA_DateTime_now();
20598  editableValue.hasSourceTimestamp = true;
20599  }
20600 
20601  /* Ok, do it */
20602  if(node->valueSource == UA_VALUESOURCE_DATA) {
20603  if(!rangeptr)
20604  retval = writeValueAttributeWithoutRange(node, &editableValue);
20605  else
20606  retval = writeValueAttributeWithRange(node, &editableValue, rangeptr);
20607 
20608  /* Callback after writing */
20609  if(retval == UA_STATUSCODE_GOOD && node->value.data.callback.onWrite) {
20610  const UA_VariableNode *writtenNode;
20611 #ifdef UA_ENABLE_MULTITHREADING
20612  /* Reopen the node to see the changes (multithreading only) */
20613  writtenNode = (const UA_VariableNode*)UA_NodeStore_get(server->nodestore, &node->nodeId);
20614 #else
20615  writtenNode = node; /* The node is written in-situ (TODO: this might
20616  change with the nodestore plugin approach) */
20617 #endif
20618  UA_RCU_UNLOCK();
20619  writtenNode->value.data.callback.onWrite(writtenNode->value.data.callback.handle,
20620  writtenNode->nodeId,
20621  &writtenNode->value.data.value.value, rangeptr);
20622  UA_RCU_LOCK();
20623  }
20624  } else {
20625  if(node->value.dataSource.write) {
20626  UA_RCU_UNLOCK();
20627  retval = node->value.dataSource.write(node->value.dataSource.handle,
20628  node->nodeId, &editableValue.value, rangeptr);
20629  UA_RCU_LOCK();
20630  } else {
20632  }
20633  }
20634 
20635  /* Clean up */
20636  cleanup:
20637  if(rangeptr)
20638  UA_free(range.dimensions);
20639  return retval;
20640 }
20641 
20642 /************************/
20643 /* IsAbstract Attribute */
20644 /************************/
20645 
20646 static UA_StatusCode
20647 readIsAbstractAttribute(const UA_Node *node, UA_Variant *v) {
20648  const UA_Boolean *isAbstract;
20649  switch(node->nodeClass) {
20651  isAbstract = &((const UA_ReferenceTypeNode*)node)->isAbstract;
20652  break;
20654  isAbstract = &((const UA_ObjectTypeNode*)node)->isAbstract;
20655  break;
20657  isAbstract = &((const UA_VariableTypeNode*)node)->isAbstract;
20658  break;
20659  case UA_NODECLASS_DATATYPE:
20660  isAbstract = &((const UA_DataTypeNode*)node)->isAbstract;
20661  break;
20662  default:
20664  }
20665  forceVariantSetScalar(v, isAbstract, &UA_TYPES[UA_TYPES_BOOLEAN]);
20666  return UA_STATUSCODE_GOOD;
20667 }
20668 
20669 static UA_StatusCode
20670 writeIsAbstractAttribute(UA_Node *node, UA_Boolean value) {
20671  switch(node->nodeClass) {
20673  ((UA_ObjectTypeNode*)node)->isAbstract = value;
20674  break;
20676  ((UA_ReferenceTypeNode*)node)->isAbstract = value;
20677  break;
20679  ((UA_VariableTypeNode*)node)->isAbstract = value;
20680  break;
20681  case UA_NODECLASS_DATATYPE:
20682  ((UA_DataTypeNode*)node)->isAbstract = value;
20683  break;
20684  default:
20686  }
20687  return UA_STATUSCODE_GOOD;
20688 }
20689 
20690 /****************/
20691 /* Read Service */
20692 /****************/
20693 
20694 static const UA_String binEncoding = {sizeof("Default Binary")-1, (UA_Byte*)"Default Binary"};
20695 /* static const UA_String xmlEncoding = {sizeof("Default Xml")-1, (UA_Byte*)"Default Xml"}; */
20696 
20697 #define CHECK_NODECLASS(CLASS) \
20698  if(!(node->nodeClass & (CLASS))) { \
20699  retval = UA_STATUSCODE_BADATTRIBUTEIDINVALID; \
20700  break; \
20701  }
20702 
20703 void Service_Read_single(UA_Server *server, UA_Session *session,
20704  const UA_TimestampsToReturn timestamps,
20705  const UA_ReadValueId *id, UA_DataValue *v) {
20706  UA_LOG_DEBUG_SESSION(server->config.logger, session,
20707  "Read the attribute %i", id->attributeId);
20708 
20709  /* XML encoding is not supported */
20710  if(id->dataEncoding.name.length > 0 &&
20711  !UA_String_equal(&binEncoding, &id->dataEncoding.name)) {
20712  v->hasStatus = true;
20714  return;
20715  }
20716 
20717  /* Index range for an attribute other than value */
20718  if(id->indexRange.length > 0 && id->attributeId != UA_ATTRIBUTEID_VALUE) {
20719  v->hasStatus = true;
20721  return;
20722  }
20723 
20724  /* Get the node */
20725  const UA_Node *node = UA_NodeStore_get(server->nodestore, &id->nodeId);
20726  if(!node) {
20727  v->hasStatus = true;
20729  return;
20730  }
20731 
20732  /* Read the attribute */
20734  switch(id->attributeId) {
20735  case UA_ATTRIBUTEID_NODEID:
20736  forceVariantSetScalar(&v->value, &node->nodeId, &UA_TYPES[UA_TYPES_NODEID]);
20737  break;
20739  forceVariantSetScalar(&v->value, &node->nodeClass, &UA_TYPES[UA_TYPES_NODECLASS]);
20740  break;
20742  forceVariantSetScalar(&v->value, &node->browseName, &UA_TYPES[UA_TYPES_QUALIFIEDNAME]);
20743  break;
20745  forceVariantSetScalar(&v->value, &node->displayName, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
20746  break;
20748  forceVariantSetScalar(&v->value, &node->description, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
20749  break;
20751  forceVariantSetScalar(&v->value, &node->writeMask, &UA_TYPES[UA_TYPES_UINT32]);
20752  break;
20754  forceVariantSetScalar(&v->value, &node->userWriteMask, &UA_TYPES[UA_TYPES_UINT32]);
20755  break;
20757  retval = readIsAbstractAttribute(node, &v->value);
20758  break;
20761  forceVariantSetScalar(&v->value, &((const UA_ReferenceTypeNode*)node)->symmetric,
20763  break;
20766  forceVariantSetScalar(&v->value, &((const UA_ReferenceTypeNode*)node)->inverseName,
20767  &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
20768  break;
20771  forceVariantSetScalar(&v->value, &((const UA_ViewNode*)node)->containsNoLoops,
20772  &UA_TYPES[UA_TYPES_BOOLEAN]);
20773  break;
20776  forceVariantSetScalar(&v->value, &((const UA_ViewNode*)node)->eventNotifier,
20778  break;
20779  case UA_ATTRIBUTEID_VALUE:
20781  retval = readValueAttributeComplete(server, (const UA_VariableNode*)node,
20782  timestamps, &id->indexRange, v);
20783  break;
20786  forceVariantSetScalar(&v->value, &((const UA_VariableTypeNode*)node)->dataType,
20787  &UA_TYPES[UA_TYPES_NODEID]);
20788  break;
20791  forceVariantSetScalar(&v->value, &((const UA_VariableTypeNode*)node)->valueRank,
20793  break;
20796  retval = readArrayDimensionsAttribute((const UA_VariableNode*)node, v);
20797  break;
20800  forceVariantSetScalar(&v->value, &((const UA_VariableNode*)node)->accessLevel,
20801  &UA_TYPES[UA_TYPES_BYTE]);
20802  break;
20805  forceVariantSetScalar(&v->value, &((const UA_VariableNode*)node)->userAccessLevel,
20806  &UA_TYPES[UA_TYPES_BYTE]);
20807  break;
20810  forceVariantSetScalar(&v->value, &((const UA_VariableNode*)node)->minimumSamplingInterval,
20812  break;
20815  forceVariantSetScalar(&v->value, &((const UA_VariableNode*)node)->historizing,
20816  &UA_TYPES[UA_TYPES_BOOLEAN]);
20817  break;
20820  forceVariantSetScalar(&v->value, &((const UA_MethodNode*)node)->executable,
20821  &UA_TYPES[UA_TYPES_BOOLEAN]);
20822  break;
20825  forceVariantSetScalar(&v->value, &((const UA_MethodNode*)node)->userExecutable,
20826  &UA_TYPES[UA_TYPES_BOOLEAN]);
20827  break;
20828  default:
20830  }
20831 
20832  /* Return error code when reading has failed */
20833  if(retval != UA_STATUSCODE_GOOD) {
20834  v->hasStatus = true;
20835  v->status = retval;
20836  return;
20837  }
20838 
20839  v->hasValue = true;
20840 
20841  /* Create server timestamp */
20842  if(timestamps == UA_TIMESTAMPSTORETURN_SERVER ||
20843  timestamps == UA_TIMESTAMPSTORETURN_BOTH) {
20845  v->hasServerTimestamp = true;
20846  }
20847 
20848  /* Handle source time stamp */
20849  if(id->attributeId == UA_ATTRIBUTEID_VALUE) {
20850  if (timestamps == UA_TIMESTAMPSTORETURN_SERVER ||
20851  timestamps == UA_TIMESTAMPSTORETURN_NEITHER) {
20852  v->hasSourceTimestamp = false;
20853  v->hasSourcePicoseconds = false;
20854  } else if(!v->hasSourceTimestamp) {
20856  v->hasSourceTimestamp = true;
20857  }
20858  }
20859 }
20860 
20861 void Service_Read(UA_Server *server, UA_Session *session,
20862  const UA_ReadRequest *request, UA_ReadResponse *response) {
20863  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing ReadRequest");
20864  if(request->nodesToReadSize <= 0) {
20866  return;
20867  }
20868 
20869  /* check if the timestampstoreturn is valid */
20872  return;
20873  }
20874 
20875  size_t size = request->nodesToReadSize;
20876  response->results = UA_Array_new(size, &UA_TYPES[UA_TYPES_DATAVALUE]);
20877  if(!response->results) {
20879  return;
20880  }
20881  response->resultsSize = size;
20882 
20883  if(request->maxAge < 0) {
20885  return;
20886  }
20887 
20888  for(size_t i = 0;i < size;++i) {
20889  Service_Read_single(server, session, request->timestampsToReturn,
20890  &request->nodesToRead[i], &response->results[i]);
20891  }
20892 
20893 #ifdef UA_ENABLE_NONSTANDARD_STATELESS
20894  /* Add an expiry header for caching */
20895  if(session->sessionId.namespaceIndex == 0 &&
20897  session->sessionId.identifier.numeric == 0){
20898  UA_ExtensionObject additionalHeader;
20899  UA_ExtensionObject_init(&additionalHeader);
20901  additionalHeader.content.encoded.typeId =UA_TYPES[UA_TYPES_VARIANT].typeId;
20902 
20903  UA_Variant variant;
20904  UA_Variant_init(&variant);
20905 
20906  UA_DateTime* expireArray = NULL;
20907  expireArray = UA_Array_new(request->nodesToReadSize,
20909  variant.data = expireArray;
20910 
20911  /* expires in 20 seconds */
20912  for(UA_UInt32 i = 0;i < response->resultsSize;++i) {
20913  expireArray[i] = UA_DateTime_now() + 20 * 100 * 1000 * 1000;
20914  }
20915  UA_Variant_setArray(&variant, expireArray, request->nodesToReadSize,
20916  &UA_TYPES[UA_TYPES_DATETIME]);
20917 
20918  size_t offset = 0;
20919  UA_ByteString str;
20920  size_t strlength = UA_calcSizeBinary(&variant, &UA_TYPES[UA_TYPES_VARIANT]);
20921  UA_ByteString_allocBuffer(&str, strlength);
20922  /* No chunking callback for the encoding */
20923  UA_StatusCode retval = UA_encodeBinary(&variant, &UA_TYPES[UA_TYPES_VARIANT],
20924  NULL, NULL, &str, &offset);
20925  UA_Array_delete(expireArray, request->nodesToReadSize, &UA_TYPES[UA_TYPES_DATETIME]);
20926  if(retval == UA_STATUSCODE_GOOD){
20927  additionalHeader.content.encoded.body.data = str.data;
20928  additionalHeader.content.encoded.body.length = offset;
20929  response->responseHeader.additionalHeader = additionalHeader;
20930  }
20931  }
20932 #endif
20933 }
20934 
20935 /* Exposes the Read service to local users */
20937 UA_Server_read(UA_Server *server, const UA_ReadValueId *item,
20938  UA_TimestampsToReturn timestamps) {
20939  UA_DataValue dv;
20940  UA_DataValue_init(&dv);
20941  UA_RCU_LOCK();
20942  Service_Read_single(server, &adminSession, timestamps, item, &dv);
20943  UA_RCU_UNLOCK();
20944  return dv;
20945 }
20946 
20947 /* Used in inline functions exposing the Read service with more syntactic sugar
20948  * for individual attributes */
20950 __UA_Server_read(UA_Server *server, const UA_NodeId *nodeId,
20951  const UA_AttributeId attributeId, void *v) {
20952  /* Call the read service */
20953  UA_ReadValueId item;
20954  UA_ReadValueId_init(&item);
20955  item.nodeId = *nodeId;
20956  item.attributeId = attributeId;
20958 
20959  /* Check the return value */
20961  if(dv.hasStatus)
20962  retval = dv.status;
20963  else if(!dv.hasValue)
20965  if(retval != UA_STATUSCODE_GOOD) {
20966  UA_DataValue_deleteMembers(&dv);
20967  return retval;
20968  }
20969 
20970  /* Prepare the result */
20971  if(attributeId == UA_ATTRIBUTEID_VALUE ||
20972  attributeId == UA_ATTRIBUTEID_ARRAYDIMENSIONS) {
20973  /* Return the entire variant */
20975  retval = UA_Variant_copy(&dv.value, v);
20976  } else {
20977  /* storageType is UA_VARIANT_DATA. Copy the entire variant
20978  * (including pointers and all) */
20979  memcpy(v, &dv.value, sizeof(UA_Variant));
20980  }
20981  } else {
20982  /* Return the variant content only */
20984  retval = UA_copy(dv.value.data, v, dv.value.type);
20985  } else {
20986  /* storageType is UA_VARIANT_DATA. Copy the content of the type
20987  * (including pointers and all) */
20988  memcpy(v, dv.value.data, dv.value.type->memSize);
20989  /* Delete the "carrier" in the variant */
20990  UA_free(dv.value.data);
20991  }
20992  }
20993  return retval;
20994 }
20995 
20996 /*****************/
20997 /* Write Service */
20998 /*****************/
20999 
21000 #define CHECK_DATATYPE_SCALAR(EXP_DT) \
21001  if(!wvalue->value.hasValue || \
21002  &UA_TYPES[UA_TYPES_##EXP_DT] != wvalue->value.value.type || \
21003  !UA_Variant_isScalar(&wvalue->value.value)) { \
21004  retval = UA_STATUSCODE_BADTYPEMISMATCH; \
21005  break; \
21006  }
21007 
21008 #define CHECK_DATATYPE_ARRAY(EXP_DT) \
21009  if(!wvalue->value.hasValue || \
21010  &UA_TYPES[UA_TYPES_##EXP_DT] != wvalue->value.value.type || \
21011  UA_Variant_isScalar(&wvalue->value.value)) { \
21012  retval = UA_STATUSCODE_BADTYPEMISMATCH; \
21013  break; \
21014  }
21015 
21016 #define CHECK_NODECLASS_WRITE(CLASS) \
21017  if((node->nodeClass & (CLASS)) == 0) { \
21018  retval = UA_STATUSCODE_BADNODECLASSINVALID; \
21019  break; \
21020  }
21021 
21022 /* This function implements the main part of the write service and operates on a
21023  copy of the node (not in single-threaded mode). */
21024 static UA_StatusCode
21025 CopyAttributeIntoNode(UA_Server *server, UA_Session *session,
21026  UA_Node *node, const UA_WriteValue *wvalue) {
21027  const void *value = wvalue->value.value.data;
21029  switch(wvalue->attributeId) {
21030  case UA_ATTRIBUTEID_NODEID:
21033  break;
21035  CHECK_DATATYPE_SCALAR(QUALIFIEDNAME);
21036  UA_QualifiedName_deleteMembers(&node->browseName);
21037  UA_QualifiedName_copy(value, &node->browseName);
21038  break;
21040  CHECK_DATATYPE_SCALAR(LOCALIZEDTEXT);
21041  UA_LocalizedText_deleteMembers(&node->displayName);
21042  UA_LocalizedText_copy(value, &node->displayName);
21043  break;
21045  CHECK_DATATYPE_SCALAR(LOCALIZEDTEXT);
21046  UA_LocalizedText_deleteMembers(&node->description);
21047  UA_LocalizedText_copy(value, &node->description);
21048  break;
21050  CHECK_DATATYPE_SCALAR(UINT32);
21051  node->writeMask = *(const UA_UInt32*)value;
21052  break;
21054  CHECK_DATATYPE_SCALAR(UINT32);
21055  node->userWriteMask = *(const UA_UInt32*)value;
21056  break;
21058  CHECK_DATATYPE_SCALAR(BOOLEAN);
21059  retval = writeIsAbstractAttribute(node, *(const UA_Boolean*)value);
21060  break;
21063  CHECK_DATATYPE_SCALAR(BOOLEAN);
21064  ((UA_ReferenceTypeNode*)node)->symmetric = *(const UA_Boolean*)value;
21065  break;
21068  CHECK_DATATYPE_SCALAR(LOCALIZEDTEXT);
21069  UA_LocalizedText_deleteMembers(&((UA_ReferenceTypeNode*)node)->inverseName);
21070  UA_LocalizedText_copy(value, &((UA_ReferenceTypeNode*)node)->inverseName);
21071  break;
21074  CHECK_DATATYPE_SCALAR(BOOLEAN);
21075  ((UA_ViewNode*)node)->containsNoLoops = *(const UA_Boolean*)value;
21076  break;
21079  CHECK_DATATYPE_SCALAR(BYTE);
21080  ((UA_ViewNode*)node)->eventNotifier = *(const UA_Byte*)value;
21081  break;
21082  case UA_ATTRIBUTEID_VALUE:
21084  retval = writeValueAttribute(server, (UA_VariableNode*)node,
21085  &wvalue->value, &wvalue->indexRange);
21086  break;
21089  CHECK_DATATYPE_SCALAR(NODEID);
21090  retval = writeDataTypeAttributeWithVT(server, (UA_VariableNode*)node, (const UA_NodeId*)value);
21091  break;
21094  CHECK_DATATYPE_SCALAR(INT32);
21095  retval = writeValueRankAttributeWithVT(server, (UA_VariableNode*)node, *(const UA_Int32*)value);
21096  break;
21099  CHECK_DATATYPE_ARRAY(UINT32);
21100  retval = writeArrayDimensionsAttribute(server, (UA_VariableNode*)node,
21101  wvalue->value.value.arrayLength,
21102  wvalue->value.value.data);
21103  break;
21106  CHECK_DATATYPE_SCALAR(BYTE);
21107  ((UA_VariableNode*)node)->accessLevel = *(const UA_Byte*)value;
21108  break;
21111  CHECK_DATATYPE_SCALAR(BYTE);
21112  ((UA_VariableNode*)node)->userAccessLevel = *(const UA_Byte*)value;
21113  break;
21116  CHECK_DATATYPE_SCALAR(DOUBLE);
21117  ((UA_VariableNode*)node)->minimumSamplingInterval = *(const UA_Double*)value;
21118  break;
21121  CHECK_DATATYPE_SCALAR(BOOLEAN);
21122  ((UA_VariableNode*)node)->historizing = *(const UA_Boolean*)value;
21123  break;
21126  CHECK_DATATYPE_SCALAR(BOOLEAN);
21127  ((UA_MethodNode*)node)->executable = *(const UA_Boolean*)value;
21128  break;
21131  CHECK_DATATYPE_SCALAR(BOOLEAN);
21132  ((UA_MethodNode*)node)->userExecutable = *(const UA_Boolean*)value;
21133  break;
21134  default:
21136  break;
21137  }
21138  if(retval != UA_STATUSCODE_GOOD)
21139  UA_LOG_INFO_SESSION(server->config.logger, session,
21140  "WriteRequest returned status code %s",
21141  UA_StatusCode_name(retval));
21142  return retval;
21143 }
21144 
21145 void
21146 Service_Write(UA_Server *server, UA_Session *session,
21147  const UA_WriteRequest *request, UA_WriteResponse *response) {
21148  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing WriteRequest");
21149  if(request->nodesToWriteSize <= 0) {
21151  return;
21152  }
21153 
21155  if(!response->results) {
21157  return;
21158  }
21159  response->resultsSize = request->nodesToWriteSize;
21160 
21161  for(size_t i = 0;i < request->nodesToWriteSize;++i) {
21162  response->results[i] = UA_Server_editNode(server, session, &request->nodesToWrite[i].nodeId,
21163  (UA_EditNodeCallback)CopyAttributeIntoNode,
21164  &request->nodesToWrite[i]);
21165  }
21166 }
21167 
21169 UA_Server_write(UA_Server *server, const UA_WriteValue *value) {
21170  UA_RCU_LOCK();
21171  UA_StatusCode retval =
21172  UA_Server_editNode(server, &adminSession, &value->nodeId,
21173  (UA_EditNodeCallback)CopyAttributeIntoNode, value);
21174  UA_RCU_UNLOCK();
21175  return retval;
21176 }
21177 
21178 /* Convenience function to be wrapped into inline functions */
21180 __UA_Server_write(UA_Server *server, const UA_NodeId *nodeId,
21181  const UA_AttributeId attributeId,
21182  const UA_DataType *attr_type,
21183  const void *attr) {
21184  UA_WriteValue wvalue;
21185  UA_WriteValue_init(&wvalue);
21186  wvalue.nodeId = *nodeId;
21187  wvalue.attributeId = attributeId;
21188  wvalue.value.hasValue = true;
21189  if(attr_type != &UA_TYPES[UA_TYPES_VARIANT]) {
21190  /* hacked cast. the target WriteValue is used as const anyway */
21191  UA_Variant_setScalar(&wvalue.value.value, (void*)(uintptr_t)attr, attr_type);
21192  } else {
21193  wvalue.value.value = *(const UA_Variant*)attr;
21194  }
21195  return UA_Server_write(server, &wvalue);
21196 }
21197 
21198 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_nodemanagement.c" ***********************************/
21199 
21200 /* This Source Code Form is subject to the terms of the Mozilla Public
21201  * License, v. 2.0. If a copy of the MPL was not distributed with this
21202  * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
21203 
21204 
21205 /************************/
21206 /* Forward Declarations */
21207 /************************/
21208 
21209 static UA_StatusCode
21210 addReference(UA_Server *server, UA_Session *session,
21211  const UA_AddReferencesItem *item);
21212 
21213 static UA_StatusCode
21214 deleteReference(UA_Server *server, UA_Session *session,
21215  const UA_DeleteReferencesItem *item);
21216 
21217 static UA_StatusCode
21218 deleteNode(UA_Server *server, UA_Session *session,
21219  const UA_NodeId *nodeId, UA_Boolean deleteReferences);
21220 
21221 /**********************/
21222 /* Consistency Checks */
21223 /**********************/
21224 
21225 /* Check if the requested parent node exists, has the right node class and is
21226  * referenced with an allowed (hierarchical) reference type. For "type" nodes,
21227  * only hasSubType references are allowed. */
21228 static UA_StatusCode
21229 checkParentReference(UA_Server *server, UA_Session *session, UA_NodeClass nodeClass,
21230  const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId) {
21231  /* Objects do not need a parent (e.g. mandatory/optional modellingrules) */
21232  if(nodeClass == UA_NODECLASS_OBJECT && UA_NodeId_isNull(parentNodeId) &&
21233  UA_NodeId_isNull(referenceTypeId))
21234  return UA_STATUSCODE_GOOD;
21235 
21236  /* See if the parent exists */
21237  const UA_Node *parent = UA_NodeStore_get(server->nodestore, parentNodeId);
21238  if(!parent) {
21239  UA_LOG_INFO_SESSION(server->config.logger, session,
21240  "AddNodes: Parent node not found");
21242  }
21243 
21244  /* Check the referencetype exists */
21245  const UA_ReferenceTypeNode *referenceType =
21246  (const UA_ReferenceTypeNode*)UA_NodeStore_get(server->nodestore, referenceTypeId);
21247  if(!referenceType) {
21248  UA_LOG_INFO_SESSION(server->config.logger, session,
21249  "AddNodes: Reference type to the parent not found");
21251  }
21252 
21253  /* Check if the referencetype is a reference type node */
21254  if(referenceType->nodeClass != UA_NODECLASS_REFERENCETYPE) {
21255  UA_LOG_INFO_SESSION(server->config.logger, session,
21256  "AddNodes: Reference type to the parent invalid");
21258  }
21259 
21260  /* Check that the reference type is not abstract */
21261  if(referenceType->isAbstract == true) {
21262  UA_LOG_INFO_SESSION(server->config.logger, session,
21263  "AddNodes: Abstract reference type to the parent not allowed");
21265  }
21266 
21267  /* Check hassubtype relation for type nodes */
21268  const UA_NodeId subtypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
21269  if(nodeClass == UA_NODECLASS_DATATYPE ||
21270  nodeClass == UA_NODECLASS_VARIABLETYPE ||
21271  nodeClass == UA_NODECLASS_OBJECTTYPE ||
21272  nodeClass == UA_NODECLASS_REFERENCETYPE) {
21273  /* type needs hassubtype reference to the supertype */
21274  if(!UA_NodeId_equal(referenceTypeId, &subtypeId)) {
21275  UA_LOG_INFO_SESSION(server->config.logger, session,
21276  "AddNodes: New type node need to have a "
21277  "HasSubType reference");
21279  }
21280  /* supertype needs to be of the same node type */
21281  if(parent->nodeClass != nodeClass) {
21282  UA_LOG_INFO_SESSION(server->config.logger, session,
21283  "AddNodes: New type node needs to be of the same "
21284  "node type as the parent");
21286  }
21287  return UA_STATUSCODE_GOOD;
21288  }
21289 
21290  /* Test if the referencetype is hierarchical */
21291  const UA_NodeId hierarchicalReference =
21292  UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES);
21293  if(!isNodeInTree(server->nodestore, referenceTypeId,
21294  &hierarchicalReference, &subtypeId, 1)) {
21295  UA_LOG_INFO_SESSION(server->config.logger, session,
21296  "AddNodes: Reference type is not hierarchical");
21298  }
21299 
21300  return UA_STATUSCODE_GOOD;
21301 }
21302 
21303 /************/
21304 /* Add Node */
21305 /************/
21306 
21307 static void
21308 Service_AddNodes_single(UA_Server *server, UA_Session *session,
21309  const UA_AddNodesItem *item, UA_AddNodesResult *result,
21310  UA_InstantiationCallback *instantiationCallback);
21311 
21312 static UA_StatusCode
21313 copyChildNodesToNode(UA_Server *server, UA_Session *session,
21314  const UA_NodeId *sourceNodeId, const UA_NodeId *destinationNodeId,
21315  UA_InstantiationCallback *instantiationCallback);
21316 
21317 /* copy an existing variable under the given parent. then instantiate the
21318  * variable for its type */
21319 static UA_StatusCode
21320 copyExistingVariable(UA_Server *server, UA_Session *session, const UA_NodeId *variable,
21321  const UA_NodeId *referenceType, const UA_NodeId *parent,
21322  UA_InstantiationCallback *instantiationCallback) {
21323  const UA_VariableNode *node =
21324  (const UA_VariableNode*)UA_NodeStore_get(server->nodestore, variable);
21325  if(!node)
21327  if(node->nodeClass != UA_NODECLASS_VARIABLE)
21329 
21330  /* Get the current value */
21331  UA_DataValue value;
21332  UA_DataValue_init(&value);
21333  UA_StatusCode retval = readValueAttribute(server, node, &value);
21334  if(retval != UA_STATUSCODE_GOOD)
21335  return retval;
21336 
21337  /* Prepare the variable description */
21338  UA_VariableAttributes attr;
21339  UA_VariableAttributes_init(&attr);
21340  attr.displayName = node->displayName;
21341  attr.description = node->description;
21342  attr.writeMask = node->writeMask;
21343  attr.userWriteMask = node->userWriteMask;
21344  attr.value = value.value;
21345  attr.dataType = node->dataType;
21346  attr.valueRank = node->valueRank;
21347  attr.arrayDimensionsSize = node->arrayDimensionsSize;
21348  attr.arrayDimensions = node->arrayDimensions;
21349  attr.accessLevel = node->accessLevel;
21350  attr.userAccessLevel = node->userAccessLevel;
21352  attr.historizing = node->historizing;
21353 
21354  UA_AddNodesItem item;
21355  UA_AddNodesItem_init(&item);
21357  item.parentNodeId.nodeId = *parent;
21358  item.referenceTypeId = *referenceType;
21359  item.browseName = node->browseName;
21362  item.nodeAttributes.content.decoded.data = &attr;
21363  const UA_VariableTypeNode *vt = (const UA_VariableTypeNode*)getNodeType(server, (const UA_Node*)node);
21364  if(!vt || vt->nodeClass != UA_NODECLASS_VARIABLETYPE || vt->isAbstract) {
21366  goto cleanup;
21367  }
21368  item.typeDefinition.nodeId = vt->nodeId;
21369 
21370  /* Add the variable and instantiate the children */
21371  UA_AddNodesResult res;
21372  UA_AddNodesResult_init(&res);
21373  Service_AddNodes_single(server, session, &item, &res, instantiationCallback);
21374  if(res.statusCode != UA_STATUSCODE_GOOD) {
21375  retval = res.statusCode;
21376  goto cleanup;
21377  }
21378  retval = copyChildNodesToNode(server, session, &node->nodeId,
21379  &res.addedNodeId, instantiationCallback);
21380 
21381  if(retval == UA_STATUSCODE_GOOD && instantiationCallback)
21382  instantiationCallback->method(res.addedNodeId, node->nodeId,
21383  instantiationCallback->handle);
21384 
21385  UA_NodeId_deleteMembers(&res.addedNodeId);
21386  cleanup:
21387  if(value.hasValue && value.value.storageType == UA_VARIANT_DATA)
21388  UA_Variant_deleteMembers(&value.value);
21389  return retval;
21390 }
21391 
21392 /* Copy an existing object under the given parent. Then instantiate for all
21393  * hastypedefinitions of the original version. */
21394 static UA_StatusCode
21395 copyExistingObject(UA_Server *server, UA_Session *session, const UA_NodeId *object,
21396  const UA_NodeId *referenceType, const UA_NodeId *parent,
21397  UA_InstantiationCallback *instantiationCallback) {
21398  const UA_ObjectNode *node =
21399  (const UA_ObjectNode*)UA_NodeStore_get(server->nodestore, object);
21400  if(!node)
21402  if(node->nodeClass != UA_NODECLASS_OBJECT)
21404 
21405  /* Prepare the item */
21406  UA_ObjectAttributes attr;
21407  UA_ObjectAttributes_init(&attr);
21408  attr.displayName = node->displayName;
21409  attr.description = node->description;
21410  attr.writeMask = node->writeMask;
21411  attr.userWriteMask = node->userWriteMask;
21412  attr.eventNotifier = node->eventNotifier;
21413 
21414  UA_AddNodesItem item;
21415  UA_AddNodesItem_init(&item);
21417  item.parentNodeId.nodeId = *parent;
21418  item.referenceTypeId = *referenceType;
21419  item.browseName = node->browseName;
21422  item.nodeAttributes.content.decoded.data = &attr;
21423  const UA_ObjectTypeNode *objtype = (const UA_ObjectTypeNode*)getNodeType(server, (const UA_Node*)node);
21424  if(!objtype || objtype->nodeClass != UA_NODECLASS_OBJECTTYPE || objtype->isAbstract)
21426  item.typeDefinition.nodeId = objtype->nodeId;
21427 
21428  /* add the new object */
21429  UA_AddNodesResult res;
21430  UA_AddNodesResult_init(&res);
21431  Service_AddNodes_single(server, session, &item, &res, instantiationCallback);
21432  if(res.statusCode != UA_STATUSCODE_GOOD)
21433  return res.statusCode;
21434 
21435  /* Copy any aggregated/nested variables/methods/subobjects this object contains
21436  * These objects may not be part of the nodes type. */
21437  UA_StatusCode retval = copyChildNodesToNode(server, session, &node->nodeId,
21438  &res.addedNodeId, instantiationCallback);
21439  if(retval == UA_STATUSCODE_GOOD && instantiationCallback)
21440  instantiationCallback->method(res.addedNodeId, node->nodeId,
21441  instantiationCallback->handle);
21442 
21443  UA_NodeId_deleteMembers(&res.addedNodeId);
21444  return retval;
21445 }
21446 
21447 static UA_StatusCode
21448 setObjectInstanceHandle(UA_Server *server, UA_Session *session,
21449  UA_ObjectNode* node, void * (*constructor)(const UA_NodeId instance)) {
21450  if(node->nodeClass != UA_NODECLASS_OBJECT)
21452  if(!node->instanceHandle)
21453  node->instanceHandle = constructor(node->nodeId);
21454  return UA_STATUSCODE_GOOD;
21455 }
21456 
21457 static UA_StatusCode
21458 instantiateNode(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId,
21459  UA_NodeClass nodeClass, const UA_NodeId *typeId,
21460  UA_InstantiationCallback *instantiationCallback) {
21461  /* see if the type node is correct */
21462  const UA_Node *typenode = UA_NodeStore_get(server->nodestore, typeId);
21463  if(!typenode)
21465  if(nodeClass == UA_NODECLASS_VARIABLE) {
21466  if(typenode->nodeClass != UA_NODECLASS_VARIABLETYPE ||
21467  ((const UA_VariableTypeNode*)typenode)->isAbstract)
21469  } else if(nodeClass == UA_NODECLASS_OBJECT) {
21470  if(typenode->nodeClass != UA_NODECLASS_OBJECTTYPE ||
21471  ((const UA_ObjectTypeNode*)typenode)->isAbstract)
21473  } else {
21475  }
21476 
21477  /* Get the hierarchy of the type and all its supertypes */
21478  UA_NodeId *hierarchy = NULL;
21479  size_t hierarchySize = 0;
21480  UA_StatusCode retval =
21481  getTypeHierarchy(server->nodestore, typenode, true, &hierarchy, &hierarchySize);
21482  if(retval != UA_STATUSCODE_GOOD)
21483  return retval;
21484 
21485  /* Copy members of the type and supertypes */
21486  for(size_t i = 0; i < hierarchySize; ++i)
21487  retval |= copyChildNodesToNode(server, session, &hierarchy[i], nodeId, instantiationCallback);
21488  UA_Array_delete(hierarchy, hierarchySize, &UA_TYPES[UA_TYPES_NODEID]);
21489  if(retval != UA_STATUSCODE_GOOD)
21490  return retval;
21491 
21492  /* Call the object constructor */
21493  if(typenode->nodeClass == UA_NODECLASS_OBJECTTYPE) {
21494  const UA_ObjectLifecycleManagement *olm =
21495  &((const UA_ObjectTypeNode*)typenode)->lifecycleManagement;
21496  if(olm->constructor)
21497  UA_Server_editNode(server, session, nodeId,
21498  (UA_EditNodeCallback)setObjectInstanceHandle,
21499  olm->constructor);
21500  }
21501 
21502  /* Add a hasType reference */
21503  UA_AddReferencesItem addref;
21504  UA_AddReferencesItem_init(&addref);
21505  addref.sourceNodeId = *nodeId;
21506  addref.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION);
21507  addref.isForward = true;
21508  addref.targetNodeId.nodeId = *typeId;
21509  return addReference(server, session, &addref);
21510 }
21511 
21512 /* Search for an instance of "browseName" in node searchInstance
21513  * Used during copyChildNodes to find overwritable/mergable nodes */
21514 static UA_StatusCode
21515 instanceFindAggregateByBrowsename(UA_Server *server, UA_Session *session,
21516  const UA_NodeId *searchInstance,
21517  const UA_QualifiedName *browseName,
21518  UA_NodeId *outInstanceNodeId) {
21520  UA_BrowseDescription_init(&bd);
21521  bd.nodeId = *searchInstance;
21522  bd.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES);
21523  bd.includeSubtypes = true;
21527 
21528  UA_BrowseResult br;
21529  UA_BrowseResult_init(&br);
21530  Service_Browse_single(server, session, NULL, &bd, 0, &br);
21531  if(br.statusCode != UA_STATUSCODE_GOOD)
21532  return br.statusCode;
21533 
21535  for(size_t i = 0; i < br.referencesSize; ++i) {
21536  UA_ReferenceDescription *rd = &br.references[i];
21537  if(rd->browseName.namespaceIndex == browseName->namespaceIndex &&
21538  UA_String_equal(&rd->browseName.name, &browseName->name)) {
21539  retval = UA_NodeId_copy(&rd->nodeId.nodeId, outInstanceNodeId);
21540  break;
21541  }
21542  }
21543 
21544  UA_BrowseResult_deleteMembers(&br);
21545  return retval;
21546 }
21547 
21548 static UA_Boolean
21549 mandatoryChild(UA_Server *server, UA_Session *session, const UA_NodeId *childNodeId) {
21550  const UA_NodeId mandatoryId = UA_NODEID_NUMERIC(0, UA_NS0ID_MODELLINGRULE_MANDATORY);
21551  const UA_NodeId hasModellingRuleId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASMODELLINGRULE);
21552 
21553  /* Get the child */
21554  const UA_Node *child = UA_NodeStore_get(server->nodestore, childNodeId);
21555  if(!child)
21556  return false;
21557 
21558  /* Look for the reference making the child mandatory */
21559  for(size_t i = 0; i < child->referencesSize; ++i) {
21560  UA_ReferenceNode *ref = &child->references[i];
21561  if(!UA_NodeId_equal(&hasModellingRuleId, &ref->referenceTypeId))
21562  continue;
21563  if(!UA_NodeId_equal(&mandatoryId, &ref->targetId.nodeId))
21564  continue;
21565  if(ref->isInverse)
21566  continue;
21567  return true;
21568  }
21569  return false;
21570 }
21571 
21572 /* Copy any children of Node sourceNodeId to another node destinationNodeId
21573  * Used at 2 places:
21574  * (1) During instantiation, when any children of the Type are copied
21575  * (2) During instantiation to copy any *nested* instances to the new node
21576  * (2.1) Might call instantiation of a type first
21577  * (2.2) *Should* then overwrite nested contents in definition --> this scenario is currently not handled!
21578  */
21579 static UA_StatusCode
21580 copyChildNodesToNode(UA_Server* server, UA_Session* session,
21581  const UA_NodeId* sourceNodeId, const UA_NodeId* destinationNodeId,
21582  UA_InstantiationCallback* instantiationCallback) {
21583  /* Browse to get all children */
21585  UA_BrowseDescription_init(&bd);
21586  bd.nodeId = *sourceNodeId;
21587  bd.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES);
21588  bd.includeSubtypes = true;
21593 
21594  UA_BrowseResult br;
21595  UA_BrowseResult_init(&br);
21596  Service_Browse_single(server, session, NULL, &bd, 0, &br);
21597  if(br.statusCode != UA_STATUSCODE_GOOD)
21598  return br.statusCode;
21599 
21600  /* Copy all children */
21602  UA_NodeId existingChild = UA_NODEID_NULL;
21603  for(size_t i = 0; i < br.referencesSize; ++i) {
21604  UA_ReferenceDescription *rd = &br.references[i];
21605 
21606  /* Is the child mandatory? If not, skip */
21607  if(!mandatoryChild(server, session, &rd->nodeId.nodeId))
21608  continue;
21609 
21610  /* TODO: If a child is optional, check whether optional children that
21611  * were manually added fit the constraints. */
21612 
21613  /* Check for deduplication */
21614  retval = instanceFindAggregateByBrowsename(server, session, destinationNodeId,
21615  &rd->browseName, &existingChild);
21616  if(retval != UA_STATUSCODE_GOOD)
21617  break;
21618 
21619  if(UA_NodeId_equal(&UA_NODEID_NULL, &existingChild)) {
21620  /* New node in child */
21621  if(rd->nodeClass == UA_NODECLASS_METHOD) {
21622  /* add a reference to the method in the objecttype */
21623  UA_AddReferencesItem newItem;
21624  UA_AddReferencesItem_init(&newItem);
21625  newItem.sourceNodeId = *destinationNodeId;
21626  newItem.referenceTypeId = rd->referenceTypeId;
21627  newItem.isForward = true;
21628  newItem.targetNodeId = rd->nodeId;
21630  retval = addReference(server, session, &newItem);
21631  } else if(rd->nodeClass == UA_NODECLASS_VARIABLE)
21632  retval = copyExistingVariable(server, session, &rd->nodeId.nodeId,
21633  &rd->referenceTypeId, destinationNodeId,
21634  instantiationCallback);
21635  else if(rd->nodeClass == UA_NODECLASS_OBJECT)
21636  retval = copyExistingObject(server, session, &rd->nodeId.nodeId,
21637  &rd->referenceTypeId, destinationNodeId,
21638  instantiationCallback);
21639  } else {
21640  /* Preexistent node in child
21641  * General strategy if we meet an already existing node:
21642  * - Preexistent variable contents always 'win' overwriting anything
21643  * supertypes would instantiate
21644  * - Always copy contents of template *into* existant node (merge
21645  * contents of e.g. Folders like ParameterSet) */
21646  if(rd->nodeClass == UA_NODECLASS_METHOD) {
21647  /* Do nothing, existent method wins */
21648  } else if(rd->nodeClass == UA_NODECLASS_VARIABLE ||
21649  rd->nodeClass == UA_NODECLASS_OBJECT) {
21650  if(!UA_NodeId_equal(&rd->nodeId.nodeId, &existingChild))
21651  retval = copyChildNodesToNode(server, session, &rd->nodeId.nodeId,
21652  &existingChild, instantiationCallback);
21653  }
21654  UA_NodeId_deleteMembers(&existingChild);
21655  }
21656  if(retval != UA_STATUSCODE_GOOD)
21657  break;
21658  }
21659  UA_BrowseResult_deleteMembers(&br);
21660  return retval;
21661 }
21662 
21664 Service_AddNodes_existing(UA_Server *server, UA_Session *session, UA_Node *node,
21665  const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId,
21666  const UA_NodeId *typeDefinition,
21667  UA_InstantiationCallback *instantiationCallback,
21668  UA_NodeId *addedNodeId) {
21670 
21671  /* Check the namespaceindex */
21672  if(node->nodeId.namespaceIndex >= server->namespacesSize) {
21673  UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Namespace invalid");
21676  }
21677 
21678  /* Check the reference to the parent */
21679  UA_StatusCode retval = checkParentReference(server, session, node->nodeClass,
21680  parentNodeId, referenceTypeId);
21681  if(retval != UA_STATUSCODE_GOOD) {
21682  UA_LOG_INFO_SESSION(server->config.logger, session,
21683  "AddNodes: Checking the reference to the parent returned "
21684  "error code %s", UA_StatusCode_name(retval));
21686  return retval;
21687  }
21688 
21689  /* Add the node to the nodestore */
21690  retval = UA_NodeStore_insert(server->nodestore, node);
21691  if(retval != UA_STATUSCODE_GOOD) {
21692  UA_LOG_INFO_SESSION(server->config.logger, session,
21693  "AddNodes: Node could not be added to the nodestore "
21694  "with error code %s", UA_StatusCode_name(retval));
21695  return retval;
21696  }
21697 
21698  /* Copy the nodeid if needed */
21699  if(addedNodeId) {
21700  retval = UA_NodeId_copy(&node->nodeId, addedNodeId);
21701  if(retval != UA_STATUSCODE_GOOD) {
21702  UA_LOG_INFO_SESSION(server->config.logger, session,
21703  "AddNodes: Could not copy the nodeid");
21704  goto remove_node;
21705  }
21706  }
21707 
21708  /* Hierarchical reference back to the parent */
21709  if(!UA_NodeId_isNull(parentNodeId)) {
21710  UA_AddReferencesItem item;
21711  UA_AddReferencesItem_init(&item);
21712  item.sourceNodeId = node->nodeId;
21713  item.referenceTypeId = *referenceTypeId;
21714  item.isForward = false;
21715  item.targetNodeId.nodeId = *parentNodeId;
21716  retval = addReference(server, session, &item);
21717  if(retval != UA_STATUSCODE_GOOD) {
21718  UA_LOG_INFO_SESSION(server->config.logger, session,
21719  "AddNodes: Could not add the reference to the parent"
21720  "with error code %s", UA_StatusCode_name(retval));
21721  goto remove_node;
21722  }
21723  }
21724 
21725  /* Fall back to a default typedefinition for variables and objects */
21726  const UA_NodeId basedatavariabletype = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE);
21727  const UA_NodeId baseobjecttype = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE);
21728  if(node->nodeClass == UA_NODECLASS_VARIABLE ||
21729  node->nodeClass == UA_NODECLASS_OBJECT) {
21730  if(!typeDefinition || UA_NodeId_isNull(typeDefinition)) {
21731  if(node->nodeClass == UA_NODECLASS_VARIABLE)
21732  typeDefinition = &basedatavariabletype;
21733  else
21734  typeDefinition = &baseobjecttype;
21735  }
21736 
21737  /* Instantiate variables and objects */
21738  retval = instantiateNode(server, session, &node->nodeId, node->nodeClass,
21739  typeDefinition, instantiationCallback);
21740  if(retval != UA_STATUSCODE_GOOD) {
21741  UA_LOG_INFO_SESSION(server->config.logger, session,
21742  "AddNodes: Could not instantiate the node with"
21743  "error code %s", UA_StatusCode_name(retval));
21744  goto remove_node;
21745  }
21746  }
21747 
21748  /* Custom callback */
21749  if(instantiationCallback)
21750  instantiationCallback->method(node->nodeId, *typeDefinition,
21751  instantiationCallback->handle);
21752  return UA_STATUSCODE_GOOD;
21753 
21754  remove_node:
21755  deleteNode(server, &adminSession, &node->nodeId, true);
21756  return retval;
21757 }
21758 
21759 /*******************************************/
21760 /* Create nodes from attribute description */
21761 /*******************************************/
21762 
21763 static UA_StatusCode
21764 copyStandardAttributes(UA_Node *node, const UA_AddNodesItem *item,
21765  const UA_NodeAttributes *attr) {
21766  UA_StatusCode retval;
21767  retval = UA_NodeId_copy(&item->requestedNewNodeId.nodeId, &node->nodeId);
21768  retval |= UA_QualifiedName_copy(&item->browseName, &node->browseName);
21769  retval |= UA_LocalizedText_copy(&attr->displayName, &node->displayName);
21770  retval |= UA_LocalizedText_copy(&attr->description, &node->description);
21771  node->writeMask = attr->writeMask;
21772  node->userWriteMask = attr->userWriteMask;
21773  return retval;
21774 }
21775 
21776 static UA_StatusCode
21777 copyCommonVariableAttributes(UA_Server *server, UA_VariableNode *node,
21778  const UA_AddNodesItem *item,
21779  const UA_VariableAttributes *attr) {
21780  const UA_NodeId basevartype = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE);
21781  const UA_NodeId basedatavartype = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE);
21782  const UA_NodeId *typeDef = &item->typeDefinition.nodeId;
21783  if(UA_NodeId_isNull(typeDef)) /* workaround when the variabletype is undefined */
21784  typeDef = &basedatavartype;
21785 
21786  /* Make sure we can instantiate the basetypes themselves */
21788  if(UA_NodeId_equal(&node->nodeId, &basevartype) ||
21789  UA_NodeId_equal(&node->nodeId, &basedatavartype)) {
21790  node->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE);
21791  node->valueRank = -2;
21792  return retval;
21793  }
21794 
21795  const UA_VariableTypeNode *vt =
21796  (const UA_VariableTypeNode*)UA_NodeStore_get(server->nodestore, typeDef);
21797  if(!vt || vt->nodeClass != UA_NODECLASS_VARIABLETYPE)
21799  if(node->nodeClass == UA_NODECLASS_VARIABLE && vt->isAbstract)
21801 
21802  /* Set the datatype */
21803  if(!UA_NodeId_isNull(&attr->dataType))
21804  retval = writeDataTypeAttribute(server, node, &attr->dataType, &vt->dataType);
21805  else /* workaround common error where the datatype is left as NA_NODEID_NULL */
21806  retval = UA_NodeId_copy(&vt->dataType, &node->dataType);
21807  if(retval != UA_STATUSCODE_GOOD)
21808  return retval;
21809 
21810  /* Set the array dimensions. Check only against the vt. */
21811  retval = compatibleArrayDimensions(vt->arrayDimensionsSize, vt->arrayDimensions,
21812  attr->arrayDimensionsSize, attr->arrayDimensions);
21813  if(retval == UA_STATUSCODE_GOOD) {
21814  retval = UA_Array_copy(attr->arrayDimensions, attr->arrayDimensionsSize,
21815  (void**)&node->arrayDimensions, &UA_TYPES[UA_TYPES_UINT32]);
21816  }
21817  if(retval != UA_STATUSCODE_GOOD) {
21818  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
21819  "Array dimensions incompatible with the VariableType "
21820  "with error code %s", UA_StatusCode_name(retval));
21821  return retval;
21822  }
21823  node->arrayDimensionsSize = attr->arrayDimensionsSize;
21824 
21825  /* Set the valuerank */
21826  if(attr->valueRank != 0 || !UA_Variant_isScalar(&attr->value))
21827  retval = writeValueRankAttribute(server, node, attr->valueRank, vt->valueRank);
21828  else /* workaround common error where the valuerank is left as 0 */
21829  node->valueRank = vt->valueRank;
21830  if(retval != UA_STATUSCODE_GOOD) {
21831  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
21832  "Value Rank incompatible with the VariableType "
21833  "with error code %s", UA_StatusCode_name(retval));
21834  return retval;
21835  }
21836 
21837  /* Set the value */
21838  UA_DataValue value;
21839  UA_DataValue_init(&value);
21840  value.hasValue = true;
21841  value.value = attr->value;
21843 
21844  /* Use the default value from the vt if none is defined */
21845  if(!value.value.type) {
21846  retval = readValueAttribute(server, (const UA_VariableNode*)vt, &value);
21847  if(retval != UA_STATUSCODE_GOOD) {
21848  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
21849  "Could not read the value of the variable type "
21850  "with error code %s", UA_StatusCode_name(retval));
21851  return retval;
21852  }
21853  }
21854 
21855  /* Write the value to the node */
21856  retval = writeValueAttribute(server, node, &value, NULL);
21857  if(retval != UA_STATUSCODE_GOOD) {
21858  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
21859  "Could not set the value of the new node "
21860  "with error code %s", UA_StatusCode_name(retval));
21861  }
21862  UA_DataValue_deleteMembers(&value);
21863  return retval;
21864 }
21865 
21866 static UA_StatusCode
21867 copyVariableNodeAttributes(UA_Server *server, UA_VariableNode *vnode,
21868  const UA_AddNodesItem *item,
21869  const UA_VariableAttributes *attr) {
21870  vnode->accessLevel = attr->accessLevel;
21871  vnode->userAccessLevel = attr->userAccessLevel;
21872  vnode->historizing = attr->historizing;
21874  return copyCommonVariableAttributes(server, vnode, item, attr);
21875 }
21876 
21877 static UA_StatusCode
21878 copyVariableTypeNodeAttributes(UA_Server *server, UA_VariableTypeNode *vtnode,
21879  const UA_AddNodesItem *item,
21880  const UA_VariableTypeAttributes *attr) {
21881  vtnode->isAbstract = attr->isAbstract;
21882  return copyCommonVariableAttributes(server, (UA_VariableNode*)vtnode, item,
21883  (const UA_VariableAttributes*)attr);
21884 }
21885 
21886 static UA_StatusCode
21887 copyObjectNodeAttributes(UA_ObjectNode *onode, const UA_ObjectAttributes *attr) {
21888  onode->eventNotifier = attr->eventNotifier;
21889  return UA_STATUSCODE_GOOD;
21890 }
21891 
21892 static UA_StatusCode
21893 copyReferenceTypeNodeAttributes(UA_ReferenceTypeNode *rtnode,
21894  const UA_ReferenceTypeAttributes *attr) {
21895  rtnode->isAbstract = attr->isAbstract;
21896  rtnode->symmetric = attr->symmetric;
21897  return UA_LocalizedText_copy(&attr->inverseName, &rtnode->inverseName);
21898 }
21899 
21900 static UA_StatusCode
21901 copyObjectTypeNodeAttributes(UA_ObjectTypeNode *otnode,
21902  const UA_ObjectTypeAttributes *attr) {
21903  otnode->isAbstract = attr->isAbstract;
21904  return UA_STATUSCODE_GOOD;
21905 }
21906 
21907 static UA_StatusCode
21908 copyViewNodeAttributes(UA_ViewNode *vnode, const UA_ViewAttributes *attr) {
21909  vnode->containsNoLoops = attr->containsNoLoops;
21910  vnode->eventNotifier = attr->eventNotifier;
21911  return UA_STATUSCODE_GOOD;
21912 }
21913 
21914 static UA_StatusCode
21915 copyDataTypeNodeAttributes(UA_DataTypeNode *dtnode,
21916  const UA_DataTypeAttributes *attr) {
21917  dtnode->isAbstract = attr->isAbstract;
21918  return UA_STATUSCODE_GOOD;
21919 }
21920 
21921 #define CHECK_ATTRIBUTES(TYPE) \
21922  if(item->nodeAttributes.content.decoded.type != &UA_TYPES[UA_TYPES_##TYPE]) { \
21923  retval = UA_STATUSCODE_BADNODEATTRIBUTESINVALID; \
21924  break; \
21925  }
21926 
21927 static UA_StatusCode
21928 createNodeFromAttributes(UA_Server *server, const UA_AddNodesItem *item, UA_Node **newNode) {
21929  /* Check that we can read the attributes */
21931  !item->nodeAttributes.content.decoded.type)
21933 
21934  /* Create the node */
21935  // todo: error case where the nodeclass is faulty
21936  void *node = UA_NodeStore_newNode(item->nodeClass);
21937  if(!node)
21939 
21940  /* Copy the attributes into the node */
21941  void *data = item->nodeAttributes.content.decoded.data;
21942  UA_StatusCode retval = copyStandardAttributes(node, item, data);
21943  switch(item->nodeClass) {
21944  case UA_NODECLASS_OBJECT:
21945  CHECK_ATTRIBUTES(OBJECTATTRIBUTES);
21946  retval |= copyObjectNodeAttributes(node, data);
21947  break;
21948  case UA_NODECLASS_VARIABLE:
21949  CHECK_ATTRIBUTES(VARIABLEATTRIBUTES);
21950  retval |= copyVariableNodeAttributes(server, node, item, data);
21951  break;
21953  CHECK_ATTRIBUTES(OBJECTTYPEATTRIBUTES);
21954  retval |= copyObjectTypeNodeAttributes(node, data);
21955  break;
21957  CHECK_ATTRIBUTES(VARIABLETYPEATTRIBUTES);
21958  retval |= copyVariableTypeNodeAttributes(server, node, item, data);
21959  break;
21961  CHECK_ATTRIBUTES(REFERENCETYPEATTRIBUTES);
21962  retval |= copyReferenceTypeNodeAttributes(node, data);
21963  break;
21964  case UA_NODECLASS_DATATYPE:
21965  CHECK_ATTRIBUTES(DATATYPEATTRIBUTES);
21966  retval |= copyDataTypeNodeAttributes(node, data);
21967  break;
21968  case UA_NODECLASS_VIEW:
21969  CHECK_ATTRIBUTES(VIEWATTRIBUTES);
21970  retval |= copyViewNodeAttributes(node, data);
21971  break;
21972  case UA_NODECLASS_METHOD:
21974  default:
21976  }
21977 
21978  if(retval == UA_STATUSCODE_GOOD)
21979  *newNode = node;
21980  else
21982  return retval;
21983 }
21984 
21985 static void
21986 Service_AddNodes_single(UA_Server *server, UA_Session *session,
21987  const UA_AddNodesItem *item, UA_AddNodesResult *result,
21988  UA_InstantiationCallback *instantiationCallback) {
21989  /* Create the node from the attributes*/
21990  UA_Node *node = NULL;
21991  result->statusCode = createNodeFromAttributes(server, item, &node);
21992  if(result->statusCode != UA_STATUSCODE_GOOD) {
21993  UA_LOG_INFO_SESSION(server->config.logger, session,
21994  "Could not add node with error code %s",
21995  UA_StatusCode_name(result->statusCode));
21996  return;
21997  }
21998 
21999  /* Run consistency checks and add the node */
22000  UA_assert(node != NULL);
22001  result->statusCode = Service_AddNodes_existing(server, session, node, &item->parentNodeId.nodeId,
22002  &item->referenceTypeId, &item->typeDefinition.nodeId,
22003  instantiationCallback, &result->addedNodeId);
22004  if(result->statusCode != UA_STATUSCODE_GOOD) {
22005  UA_LOG_INFO_SESSION(server->config.logger, session,
22006  "Could not add node with error code %s",
22007  UA_StatusCode_name(result->statusCode));
22008  }
22009 }
22010 
22011 void Service_AddNodes(UA_Server *server, UA_Session *session,
22012  const UA_AddNodesRequest *request,
22013  UA_AddNodesResponse *response) {
22014  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing AddNodesRequest");
22015  if(request->nodesToAddSize <= 0) {
22017  return;
22018  }
22019  size_t size = request->nodesToAddSize;
22020 
22022  if(!response->results) {
22024  return;
22025  }
22026 
22027 
22028  response->resultsSize = size;
22029  for(size_t i = 0; i < size; ++i) {
22030  Service_AddNodes_single(server, session, &request->nodesToAdd[i],
22031  &response->results[i], NULL);
22032  }
22033 }
22034 
22036 __UA_Server_addNode(UA_Server *server, const UA_NodeClass nodeClass,
22037  const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId,
22038  const UA_NodeId referenceTypeId, const UA_QualifiedName browseName,
22039  const UA_NodeId typeDefinition, const UA_NodeAttributes *attr,
22040  const UA_DataType *attributeType,
22041  UA_InstantiationCallback *instantiationCallback, UA_NodeId *outNewNodeId) {
22042  /* prepare the item */
22043  UA_AddNodesItem item;
22044  UA_AddNodesItem_init(&item);
22045  item.parentNodeId.nodeId = parentNodeId;
22046  item.referenceTypeId = referenceTypeId;
22047  item.requestedNewNodeId.nodeId = requestedNewNodeId;
22048  item.browseName = browseName;
22049  item.nodeClass = nodeClass;
22050  item.typeDefinition.nodeId = typeDefinition;
22053  .content.decoded = {attributeType, (void*)(uintptr_t)attr}};
22054 
22055  /* run the service */
22056  UA_AddNodesResult result;
22057  UA_AddNodesResult_init(&result);
22058  UA_RCU_LOCK();
22059  Service_AddNodes_single(server, &adminSession, &item, &result, instantiationCallback);
22060  UA_RCU_UNLOCK();
22061 
22062  /* prepare the output */
22063  if(outNewNodeId && result.statusCode == UA_STATUSCODE_GOOD)
22064  *outNewNodeId = result.addedNodeId;
22065  else
22066  UA_NodeId_deleteMembers(&result.addedNodeId);
22067  return result.statusCode;
22068 }
22069 
22070 /**************************************************/
22071 /* Add Special Nodes (not possible over the wire) */
22072 /**************************************************/
22073 
22075 UA_Server_addDataSourceVariableNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
22076  const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
22077  const UA_QualifiedName browseName, const UA_NodeId typeDefinition,
22078  const UA_VariableAttributes attr, const UA_DataSource dataSource,
22079  UA_NodeId *outNewNodeId) {
22080  /* Create the new node */
22081  UA_VariableNode *node = UA_NodeStore_newVariableNode();
22082  if(!node)
22084 
22085  /* Read the current value (to do typechecking) */
22087  UA_VariableAttributes editAttr = attr;
22088  UA_DataValue value;
22089  UA_DataValue_init(&value);
22090  if(dataSource.read)
22091  retval = dataSource.read(dataSource.handle, requestedNewNodeId,
22092  false, NULL, &value);
22093  else
22095  editAttr.value = value.value;
22096 
22097  if(retval != UA_STATUSCODE_GOOD) {
22098  UA_NodeStore_deleteNode((UA_Node*)node);
22099  return retval;
22100  }
22101 
22102  /* Copy attributes into node */
22103  UA_RCU_LOCK();
22104  UA_AddNodesItem item;
22105  UA_AddNodesItem_init(&item);
22106  item.requestedNewNodeId.nodeId = requestedNewNodeId;
22107  item.browseName = browseName;
22108  item.typeDefinition.nodeId = typeDefinition;
22109  item.parentNodeId.nodeId = parentNodeId;
22110  retval |= copyStandardAttributes((UA_Node*)node, &item, (const UA_NodeAttributes*)&editAttr);
22111  retval |= copyVariableNodeAttributes(server, node, &item, &editAttr);
22112  UA_DataValue_deleteMembers(&node->value.data.value);
22113  node->valueSource = UA_VALUESOURCE_DATASOURCE;
22114  node->value.dataSource = dataSource;
22115  UA_DataValue_deleteMembers(&value);
22116  if(retval != UA_STATUSCODE_GOOD) {
22117  UA_NodeStore_deleteNode((UA_Node*)node);
22118  UA_RCU_UNLOCK();
22119  return retval;
22120  }
22121 
22122  /* Add the node */
22123  UA_AddNodesResult result;
22124  UA_AddNodesResult_init(&result);
22125  retval = Service_AddNodes_existing(server, &adminSession, (UA_Node*)node, &parentNodeId,
22126  &referenceTypeId, &typeDefinition, NULL, outNewNodeId);
22127  UA_RCU_UNLOCK();
22128  return retval;
22129 }
22130 
22131 #ifdef UA_ENABLE_METHODCALLS
22132 
22134 UA_Server_addMethodNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
22135  const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
22136  const UA_QualifiedName browseName, const UA_MethodAttributes attr,
22137  UA_MethodCallback method, void *handle,
22138  size_t inputArgumentsSize, const UA_Argument* inputArguments,
22139  size_t outputArgumentsSize, const UA_Argument* outputArguments,
22140  UA_NodeId *outNewNodeId) {
22142  if(!node)
22144 
22145  UA_AddNodesItem item;
22146  UA_AddNodesItem_init(&item);
22147  item.requestedNewNodeId.nodeId = requestedNewNodeId;
22148  item.browseName = browseName;
22149  copyStandardAttributes((UA_Node*)node, &item, (const UA_NodeAttributes*)&attr);
22150  node->executable = attr.executable;
22151  node->userExecutable = attr.userExecutable;
22152  node->attachedMethod = method;
22153  node->methodHandle = handle;
22154 
22155  /* Add the node */
22156  UA_NodeId newMethodId;
22157  UA_NodeId_init(&newMethodId);
22158  UA_RCU_LOCK();
22159  UA_StatusCode retval = Service_AddNodes_existing(server, &adminSession, (UA_Node*)node, &parentNodeId,
22160  &referenceTypeId, &UA_NODEID_NULL, NULL, &newMethodId);
22161  UA_RCU_UNLOCK();
22162  if(retval != UA_STATUSCODE_GOOD)
22163  return retval;
22164 
22165  const UA_NodeId hasproperty = UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY);
22166  const UA_NodeId propertytype = UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE);
22167 
22168  if(inputArgumentsSize > 0) {
22169  UA_VariableNode *inputArgumentsVariableNode = UA_NodeStore_newVariableNode();
22170  inputArgumentsVariableNode->nodeId.namespaceIndex = newMethodId.namespaceIndex;
22171  inputArgumentsVariableNode->browseName = UA_QUALIFIEDNAME_ALLOC(0, "InputArguments");
22172  inputArgumentsVariableNode->displayName = UA_LOCALIZEDTEXT_ALLOC("en_US", "InputArguments");
22173  inputArgumentsVariableNode->description = UA_LOCALIZEDTEXT_ALLOC("en_US", "InputArguments");
22174  inputArgumentsVariableNode->valueRank = 1;
22175 
22176  /* UAExpert creates a monitoreditem on inputarguments ... */
22177  inputArgumentsVariableNode->minimumSamplingInterval = 10000.0f;
22178 
22179  //TODO: 0.3 work item: the addMethodNode API does not have the possibility to set nodeIDs
22180  //actually we need to change the signature to pass UA_NS0ID_SERVER_GETMONITOREDITEMS_INPUTARGUMENTS
22181  //and UA_NS0ID_SERVER_GETMONITOREDITEMS_OUTPUTARGUMENTS into the function :/
22182  if(newMethodId.namespaceIndex == 0 &&
22183  newMethodId.identifierType == UA_NODEIDTYPE_NUMERIC &&
22185  inputArgumentsVariableNode->nodeId =
22187  }
22188  UA_Variant_setArrayCopy(&inputArgumentsVariableNode->value.data.value.value,
22189  inputArguments, inputArgumentsSize,
22191  inputArgumentsVariableNode->value.data.value.hasValue = true;
22192  UA_RCU_LOCK();
22193  // todo: check if adding succeeded
22194  Service_AddNodes_existing(server, &adminSession, (UA_Node*)inputArgumentsVariableNode,
22195  &newMethodId, &hasproperty, &propertytype, NULL, NULL);
22196  UA_RCU_UNLOCK();
22197  }
22198 
22199  if(outputArgumentsSize > 0) {
22200  /* create OutputArguments */
22201  UA_VariableNode *outputArgumentsVariableNode = UA_NodeStore_newVariableNode();
22202  outputArgumentsVariableNode->nodeId.namespaceIndex = newMethodId.namespaceIndex;
22203  outputArgumentsVariableNode->browseName = UA_QUALIFIEDNAME_ALLOC(0, "OutputArguments");
22204  outputArgumentsVariableNode->displayName = UA_LOCALIZEDTEXT_ALLOC("en_US", "OutputArguments");
22205  outputArgumentsVariableNode->description = UA_LOCALIZEDTEXT_ALLOC("en_US", "OutputArguments");
22206  outputArgumentsVariableNode->valueRank = 1;
22207  //FIXME: comment in line 882
22208  if(newMethodId.namespaceIndex == 0 &&
22209  newMethodId.identifierType == UA_NODEIDTYPE_NUMERIC &&
22211  outputArgumentsVariableNode->nodeId =
22213  }
22214  UA_Variant_setArrayCopy(&outputArgumentsVariableNode->value.data.value.value,
22215  outputArguments, outputArgumentsSize,
22217  outputArgumentsVariableNode->value.data.value.hasValue = true;
22218  UA_RCU_LOCK();
22219  // todo: check if adding succeeded
22220  Service_AddNodes_existing(server, &adminSession, (UA_Node*)outputArgumentsVariableNode,
22221  &newMethodId, &hasproperty, &propertytype, NULL, NULL);
22222  UA_RCU_UNLOCK();
22223  }
22224 
22225  if(outNewNodeId)
22226  *outNewNodeId = newMethodId;
22227  else
22228  UA_NodeId_deleteMembers(&newMethodId);
22229  return retval;
22230 }
22231 
22232 #endif
22233 
22234 /******************/
22235 /* Add References */
22236 /******************/
22237 
22238 static UA_StatusCode
22239 deleteOneWayReference(UA_Server *server, UA_Session *session, UA_Node *node,
22240  const UA_DeleteReferencesItem *item);
22241 
22242 /* Adds a one-way reference to the local nodestore */
22243 static UA_StatusCode
22244 addOneWayReference(UA_Server *server, UA_Session *session,
22245  UA_Node *node, const UA_AddReferencesItem *item) {
22246  size_t i = node->referencesSize;
22247  size_t refssize = (i+1) | 3; // so the realloc is not necessary every time
22248  UA_ReferenceNode *new_refs = UA_realloc(node->references, sizeof(UA_ReferenceNode) * refssize);
22249  if(!new_refs)
22251  node->references = new_refs;
22252  UA_ReferenceNode_init(&new_refs[i]);
22253  UA_StatusCode retval = UA_NodeId_copy(&item->referenceTypeId, &new_refs[i].referenceTypeId);
22254  retval |= UA_ExpandedNodeId_copy(&item->targetNodeId, &new_refs[i].targetId);
22255  new_refs[i].isInverse = !item->isForward;
22256  if(retval == UA_STATUSCODE_GOOD)
22257  node->referencesSize = i+1;
22258  else
22259  UA_ReferenceNode_deleteMembers(&new_refs[i]);
22260  return retval;
22261 }
22262 
22263 static UA_StatusCode
22264 addReference(UA_Server *server, UA_Session *session,
22265  const UA_AddReferencesItem *item) {
22266  /* Currently no expandednodeids are allowed */
22267  if(item->targetServerUri.length > 0)
22269 
22270  /* Add the first direction */
22271  UA_StatusCode retval = UA_Server_editNode(server, session, &item->sourceNodeId,
22272  (UA_EditNodeCallback)addOneWayReference,
22273  item);
22274 
22275 
22276  if(retval != UA_STATUSCODE_GOOD)
22277  return retval;
22278 
22279  /* Add the second direction */
22280  UA_AddReferencesItem secondItem;
22281  UA_AddReferencesItem_init(&secondItem);
22282  secondItem.sourceNodeId = item->targetNodeId.nodeId;
22283  secondItem.referenceTypeId = item->referenceTypeId;
22284  secondItem.isForward = !item->isForward;
22285  secondItem.targetNodeId.nodeId = item->sourceNodeId;
22286  /* keep default secondItem.targetNodeClass = UA_NODECLASS_UNSPECIFIED */
22287 
22288  retval = UA_Server_editNode(server, session, &secondItem.sourceNodeId,
22289  (UA_EditNodeCallback)addOneWayReference, &secondItem);
22290 
22291  /* remove reference if the second direction failed */
22292  if(retval != UA_STATUSCODE_GOOD) {
22293  UA_DeleteReferencesItem deleteItem;
22294  deleteItem.sourceNodeId = item->sourceNodeId;
22295  deleteItem.referenceTypeId = item->referenceTypeId;
22296  deleteItem.isForward = item->isForward;
22297  deleteItem.targetNodeId = item->targetNodeId;
22298  deleteItem.deleteBidirectional = false;
22299  /* ignore returned status code */
22300  UA_Server_editNode(server, session, &item->sourceNodeId,
22301  (UA_EditNodeCallback)deleteOneWayReference, &deleteItem);
22302  }
22303  return retval;
22304 }
22305 
22306 void Service_AddReferences(UA_Server *server, UA_Session *session,
22307  const UA_AddReferencesRequest *request,
22308  UA_AddReferencesResponse *response) {
22309  UA_LOG_DEBUG_SESSION(server->config.logger, session,
22310  "Processing AddReferencesRequest");
22311  if(request->referencesToAddSize <= 0) {
22313  return;
22314  }
22315 
22316  response->results = UA_malloc(sizeof(UA_StatusCode) * request->referencesToAddSize);
22317  if(!response->results) {
22319  return;
22320  }
22321  response->resultsSize = request->referencesToAddSize;
22322 
22323  for(size_t i = 0; i < response->resultsSize; ++i)
22324  response->results[i] =
22325  addReference(server, session, &request->referencesToAdd[i]);
22326 }
22327 
22329 UA_Server_addReference(UA_Server *server, const UA_NodeId sourceId,
22330  const UA_NodeId refTypeId, const UA_ExpandedNodeId targetId,
22331  UA_Boolean isForward) {
22332  UA_AddReferencesItem item;
22333  UA_AddReferencesItem_init(&item);
22334  item.sourceNodeId = sourceId;
22335  item.referenceTypeId = refTypeId;
22336  item.isForward = isForward;
22337  item.targetNodeId = targetId;
22338  UA_RCU_LOCK();
22339  UA_StatusCode retval = addReference(server, &adminSession, &item);
22340  UA_RCU_UNLOCK();
22341  return retval;
22342 }
22343 
22344 /****************/
22345 /* Delete Nodes */
22346 /****************/
22347 
22348 static void
22349 removeReferences(UA_Server *server, UA_Session *session, const UA_Node *node) {
22351  UA_DeleteReferencesItem_init(&item);
22352  item.targetNodeId.nodeId = node->nodeId;
22353  for(size_t i = 0; i < node->referencesSize; ++i) {
22354  item.isForward = node->references[i].isInverse;
22355  item.sourceNodeId = node->references[i].targetId.nodeId;
22356  item.referenceTypeId = node->references[i].referenceTypeId;
22357  deleteReference(server, session, &item);
22358  }
22359 }
22360 
22361 static UA_StatusCode
22362 deleteNode(UA_Server *server, UA_Session *session,
22363  const UA_NodeId *nodeId, UA_Boolean deleteReferences) {
22364  const UA_Node *node = UA_NodeStore_get(server->nodestore, nodeId);
22365  if(!node)
22367 
22368  /* TODO: check if the information model consistency is violated */
22369  /* TODO: Check if the node is a mandatory child of an object */
22370 
22371  /* Destroy an object before removing it */
22372  if(node->nodeClass == UA_NODECLASS_OBJECT) {
22373  /* Call the destructor from the object type */
22374  const UA_ObjectTypeNode *typenode = getObjectNodeType(server, (const UA_ObjectNode*)node);
22375  if(typenode && typenode->lifecycleManagement.destructor)
22376  typenode->lifecycleManagement.destructor(*nodeId, ((const UA_ObjectNode*)node)->instanceHandle);
22377  }
22378 
22379  /* Remove references to the node (not the references in the node that will
22380  * be deleted anyway) */
22381  if(deleteReferences)
22382  removeReferences(server, session, node);
22383 
22384  return UA_NodeStore_remove(server->nodestore, nodeId);
22385 }
22386 
22387 void Service_DeleteNodes(UA_Server *server, UA_Session *session,
22388  const UA_DeleteNodesRequest *request,
22389  UA_DeleteNodesResponse *response) {
22390  UA_LOG_DEBUG_SESSION(server->config.logger, session,
22391  "Processing DeleteNodesRequest");
22392  if(request->nodesToDeleteSize == 0) {
22394  return;
22395  }
22396 
22397  response->results = UA_malloc(sizeof(UA_StatusCode) * request->nodesToDeleteSize);
22398  if(!response->results) {
22400  return;
22401  }
22402  response->resultsSize = request->nodesToDeleteSize;
22403 
22404  for(size_t i = 0; i < request->nodesToDeleteSize; ++i) {
22405  UA_DeleteNodesItem *item = &request->nodesToDelete[i];
22406  response->results[i] = deleteNode(server, session, &item->nodeId,
22407  item->deleteTargetReferences);
22408  }
22409 }
22410 
22412 UA_Server_deleteNode(UA_Server *server, const UA_NodeId nodeId,
22413  UA_Boolean deleteReferences) {
22414  UA_RCU_LOCK();
22415  UA_StatusCode retval = deleteNode(server, &adminSession,
22416  &nodeId, deleteReferences);
22417  UA_RCU_UNLOCK();
22418  return retval;
22419 }
22420 
22421 /*********************/
22422 /* Delete References */
22423 /*********************/
22424 
22425 // TODO: Check consistency constraints, remove the references.
22426 static UA_StatusCode
22427 deleteOneWayReference(UA_Server *server, UA_Session *session, UA_Node *node,
22428  const UA_DeleteReferencesItem *item) {
22429  UA_Boolean edited = false;
22430  for(size_t i = node->referencesSize; i > 0; --i) {
22431  UA_ReferenceNode *ref = &node->references[i-1];
22432  if(!UA_NodeId_equal(&item->targetNodeId.nodeId, &ref->targetId.nodeId))
22433  continue;
22434  if(!UA_NodeId_equal(&item->referenceTypeId, &ref->referenceTypeId))
22435  continue;
22436  if(item->isForward == ref->isInverse)
22437  continue;
22438  UA_ReferenceNode_deleteMembers(ref);
22439  /* move the last entry to override the current position */
22440  node->references[i-1] = node->references[node->referencesSize-1];
22441  --node->referencesSize;
22442  edited = true;
22443  break;
22444  }
22445  if(!edited)
22447  /* we removed the last reference */
22448  if(node->referencesSize == 0 && node->references) {
22449  UA_free(node->references);
22450  node->references = NULL;
22451  }
22452  return UA_STATUSCODE_GOOD;;
22453 }
22454 
22455 static UA_StatusCode
22456 deleteReference(UA_Server *server, UA_Session *session,
22457  const UA_DeleteReferencesItem *item) {
22458  UA_StatusCode retval = UA_Server_editNode(server, session, &item->sourceNodeId,
22459  (UA_EditNodeCallback)deleteOneWayReference, item);
22460  if(retval != UA_STATUSCODE_GOOD)
22461  return retval;
22462  if(!item->deleteBidirectional || item->targetNodeId.serverIndex != 0)
22463  return retval;
22464  UA_DeleteReferencesItem secondItem;
22465  UA_DeleteReferencesItem_init(&secondItem);
22466  secondItem.isForward = !item->isForward;
22467  secondItem.sourceNodeId = item->targetNodeId.nodeId;
22468  secondItem.targetNodeId.nodeId = item->sourceNodeId;
22469  secondItem.referenceTypeId = item->referenceTypeId;
22470  return UA_Server_editNode(server, session, &secondItem.sourceNodeId,
22471  (UA_EditNodeCallback)deleteOneWayReference, &secondItem);
22472 }
22473 
22474 void
22475 Service_DeleteReferences(UA_Server *server, UA_Session *session,
22476  const UA_DeleteReferencesRequest *request,
22477  UA_DeleteReferencesResponse *response) {
22478  UA_LOG_DEBUG_SESSION(server->config.logger, session,
22479  "Processing DeleteReferencesRequest");
22480  if(request->referencesToDeleteSize <= 0) {
22482  return;
22483  }
22484 
22485  response->results = UA_malloc(sizeof(UA_StatusCode) * request->referencesToDeleteSize);
22486  if(!response->results) {
22488  return;
22489  }
22490  response->resultsSize = request->referencesToDeleteSize;
22491 
22492  for(size_t i = 0; i < request->referencesToDeleteSize; ++i)
22493  response->results[i] =
22494  deleteReference(server, session, &request->referencesToDelete[i]);
22495 }
22496 
22498 UA_Server_deleteReference(UA_Server *server, const UA_NodeId sourceNodeId,
22499  const UA_NodeId referenceTypeId,
22500  UA_Boolean isForward, const UA_ExpandedNodeId targetNodeId,
22501  UA_Boolean deleteBidirectional) {
22503  item.sourceNodeId = sourceNodeId;
22504  item.referenceTypeId = referenceTypeId;
22505  item.isForward = isForward;
22506  item.targetNodeId = targetNodeId;
22507  item.deleteBidirectional = deleteBidirectional;
22508  UA_RCU_LOCK();
22509  UA_StatusCode retval = deleteReference(server, &adminSession, &item);
22510  UA_RCU_UNLOCK();
22511  return retval;
22512 }
22513 
22514 /**********************/
22515 /* Set Value Callback */
22516 /**********************/
22517 
22518 static UA_StatusCode
22519 setValueCallback(UA_Server *server, UA_Session *session,
22520  UA_VariableNode *node, UA_ValueCallback *callback) {
22521  if(node->nodeClass != UA_NODECLASS_VARIABLE)
22523  node->value.data.callback = *callback;
22524  return UA_STATUSCODE_GOOD;
22525 }
22526 
22528 UA_Server_setVariableNode_valueCallback(UA_Server *server, const UA_NodeId nodeId,
22529  const UA_ValueCallback callback) {
22530  UA_RCU_LOCK();
22531  UA_StatusCode retval = UA_Server_editNode(server, &adminSession, &nodeId,
22532  (UA_EditNodeCallback)setValueCallback, &callback);
22533  UA_RCU_UNLOCK();
22534  return retval;
22535 }
22536 
22537 /******************/
22538 /* Set DataSource */
22539 /******************/
22540 
22541 static UA_StatusCode
22542 setDataSource(UA_Server *server, UA_Session *session,
22543  UA_VariableNode* node, UA_DataSource *dataSource) {
22544  if(node->nodeClass != UA_NODECLASS_VARIABLE)
22546  if(node->valueSource == UA_VALUESOURCE_DATA)
22547  UA_DataValue_deleteMembers(&node->value.data.value);
22548  node->value.dataSource = *dataSource;
22549  node->valueSource = UA_VALUESOURCE_DATASOURCE;
22550  return UA_STATUSCODE_GOOD;
22551 }
22552 
22554 UA_Server_setVariableNode_dataSource(UA_Server *server, const UA_NodeId nodeId,
22555  const UA_DataSource dataSource) {
22556  UA_RCU_LOCK();
22557  UA_StatusCode retval = UA_Server_editNode(server, &adminSession, &nodeId,
22558  (UA_EditNodeCallback)setDataSource, &dataSource);
22559  UA_RCU_UNLOCK();
22560  return retval;
22561 }
22562 
22563 /****************************/
22564 /* Set Lifecycle Management */
22565 /****************************/
22566 
22567 static UA_StatusCode
22568 setOLM(UA_Server *server, UA_Session *session,
22569  UA_ObjectTypeNode* node, UA_ObjectLifecycleManagement *olm) {
22570  if(node->nodeClass != UA_NODECLASS_OBJECTTYPE)
22572  node->lifecycleManagement = *olm;
22573  return UA_STATUSCODE_GOOD;
22574 }
22575 
22578  UA_ObjectLifecycleManagement olm) {
22579  UA_RCU_LOCK();
22580  UA_StatusCode retval = UA_Server_editNode(server, &adminSession, &nodeId,
22581  (UA_EditNodeCallback)setOLM, &olm);
22582  UA_RCU_UNLOCK();
22583  return retval;
22584 }
22585 
22586 /***********************/
22587 /* Set Method Callback */
22588 /***********************/
22589 
22590 #ifdef UA_ENABLE_METHODCALLS
22591 
22592 struct addMethodCallback {
22593  UA_MethodCallback callback;
22594  void *handle;
22595 };
22596 
22597 static UA_StatusCode
22598 editMethodCallback(UA_Server *server, UA_Session* session,
22599  UA_Node* node, const void* handle) {
22600  if(node->nodeClass != UA_NODECLASS_METHOD)
22602  const struct addMethodCallback *newCallback = handle;
22603  UA_MethodNode *mnode = (UA_MethodNode*) node;
22604  mnode->attachedMethod = newCallback->callback;
22605  mnode->methodHandle = newCallback->handle;
22606  return UA_STATUSCODE_GOOD;
22607 }
22608 
22610 UA_Server_setMethodNode_callback(UA_Server *server, const UA_NodeId methodNodeId,
22611  UA_MethodCallback method, void *handle) {
22612  struct addMethodCallback cb = { method, handle };
22613  UA_RCU_LOCK();
22614  UA_StatusCode retval = UA_Server_editNode(server, &adminSession,
22615  &methodNodeId, editMethodCallback, &cb);
22616  UA_RCU_UNLOCK();
22617  return retval;
22618 }
22619 
22620 #endif
22621 
22622 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_view.c" ***********************************/
22623 
22624 /* This Source Code Form is subject to the terms of the Mozilla Public
22625 * License, v. 2.0. If a copy of the MPL was not distributed with this
22626 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
22627 
22628 
22629 static UA_StatusCode
22630 fillReferenceDescription(UA_NodeStore *ns, const UA_Node *curr, UA_ReferenceNode *ref,
22631  UA_UInt32 mask, UA_ReferenceDescription *descr) {
22632  UA_ReferenceDescription_init(descr);
22633  UA_StatusCode retval = UA_NodeId_copy(&curr->nodeId, &descr->nodeId.nodeId);
22635  retval |= UA_NodeId_copy(&ref->referenceTypeId, &descr->referenceTypeId);
22637  descr->isForward = !ref->isInverse;
22639  retval |= UA_NodeClass_copy(&curr->nodeClass, &descr->nodeClass);
22641  retval |= UA_QualifiedName_copy(&curr->browseName, &descr->browseName);
22643  retval |= UA_LocalizedText_copy(&curr->displayName, &descr->displayName);
22645  if(curr->nodeClass == UA_NODECLASS_OBJECT || curr->nodeClass == UA_NODECLASS_VARIABLE) {
22646  for(size_t i = 0; i < curr->referencesSize; ++i) {
22647  UA_ReferenceNode *refnode = &curr->references[i];
22649  retval |= UA_ExpandedNodeId_copy(&refnode->targetId, &descr->typeDefinition);
22650  break;
22651  }
22652  }
22653  }
22654  }
22655  return retval;
22656 }
22657 
22658 
22659 /* Tests if the node is relevant to the browse request and shall be returned. If
22660  so, it is retrieved from the Nodestore. If not, null is returned. */
22661 static const UA_Node *
22662 returnRelevantNode(UA_Server *server, const UA_BrowseDescription *descr, UA_Boolean return_all,
22663  const UA_ReferenceNode *reference, const UA_NodeId *relevant, size_t relevant_count,
22664  UA_Boolean *isExternal) {
22665  /* reference in the right direction? */
22666  if(reference->isInverse && descr->browseDirection == UA_BROWSEDIRECTION_FORWARD)
22667  return NULL;
22668  if(!reference->isInverse && descr->browseDirection == UA_BROWSEDIRECTION_INVERSE)
22669  return NULL;
22670 
22671  /* is the reference part of the hierarchy of references we look for? */
22672  if(!return_all) {
22673  UA_Boolean is_relevant = false;
22674  for(size_t i = 0; i < relevant_count; ++i) {
22675  if(UA_NodeId_equal(&reference->referenceTypeId, &relevant[i])) {
22676  is_relevant = true;
22677  break;
22678  }
22679  }
22680  if(!is_relevant)
22681  return NULL;
22682  }
22683 
22684 
22685  /* return from the internal nodestore */
22686  const UA_Node *node = UA_NodeStore_get(server->nodestore, &reference->targetId.nodeId);
22687  if(node && descr->nodeClassMask != 0 && (node->nodeClass & descr->nodeClassMask) == 0)
22688  return NULL;
22689  *isExternal = false;
22690  return node;
22691 }
22692 
22693 static void removeCp(struct ContinuationPointEntry *cp, UA_Session* session) {
22694  LIST_REMOVE(cp, pointers);
22695  UA_ByteString_deleteMembers(&cp->identifier);
22696  UA_BrowseDescription_deleteMembers(&cp->browseDescription);
22697  UA_free(cp);
22698  ++session->availableContinuationPoints;
22699 }
22700 
22701 /* Results for a single browsedescription. This is the inner loop for both
22702  * Browse and BrowseNext
22703  *
22704  * @param session Session to save continuationpoints
22705  * @param ns The nodstore where the to-be-browsed node can be found
22706  * @param cp If cp is not null, we continue from here If cp is null, we can add
22707  * a new continuation point if possible and necessary.
22708  * @param descr If no cp is set, we take the browsedescription from there
22709  * @param maxrefs The maximum number of references the client has requested. If 0,
22710  * all matching references are returned at once.
22711  * @param result The entry in the request */
22712 void
22713 Service_Browse_single(UA_Server *server, UA_Session *session,
22714  struct ContinuationPointEntry *cp, const UA_BrowseDescription *descr,
22715  UA_UInt32 maxrefs, UA_BrowseResult *result) {
22716  size_t referencesCount = 0;
22717  size_t referencesIndex = 0;
22718  /* set the browsedescription if a cp is given */
22719  UA_UInt32 continuationIndex = 0;
22720  struct ContinuationPointEntry *cpLoop = NULL, *cpLast = NULL;
22721  if(cp) {
22722  descr = &cp->browseDescription;
22723  maxrefs = cp->maxReferences;
22724  continuationIndex = cp->continuationIndex;
22725  }
22726 
22727  /* is the browsedirection valid? */
22732  return;
22733  }
22734 
22735  /* get the references that match the browsedescription */
22736  size_t relevant_refs_size = 0;
22737  UA_NodeId *relevant_refs = NULL;
22738  UA_Boolean all_refs = UA_NodeId_isNull(&descr->referenceTypeId);
22739  if(!all_refs) {
22740  const UA_Node *rootRef = UA_NodeStore_get(server->nodestore, &descr->referenceTypeId);
22741  if(!rootRef || rootRef->nodeClass != UA_NODECLASS_REFERENCETYPE) {
22743  return;
22744  }
22745  if(descr->includeSubtypes) {
22746  result->statusCode = getTypeHierarchy(server->nodestore, rootRef, false,
22747  &relevant_refs, &relevant_refs_size);
22748  if(result->statusCode != UA_STATUSCODE_GOOD)
22749  return;
22750  } else {
22751  relevant_refs = (UA_NodeId*)(uintptr_t)&descr->referenceTypeId;
22752  relevant_refs_size = 1;
22753  }
22754  }
22755 
22756  /* get the node */
22757  const UA_Node *node = UA_NodeStore_get(server->nodestore, &descr->nodeId);
22758  if(!node) {
22760  if(!all_refs && descr->includeSubtypes)
22761  UA_Array_delete(relevant_refs, relevant_refs_size, &UA_TYPES[UA_TYPES_NODEID]);
22762  return;
22763  }
22764 
22765  /* if the node has no references, just return */
22766  if(node->referencesSize == 0) {
22767  result->referencesSize = 0;
22768  if(!all_refs && descr->includeSubtypes)
22769  UA_Array_delete(relevant_refs, relevant_refs_size, &UA_TYPES[UA_TYPES_NODEID]);
22770  return;
22771  }
22772 
22773  /* how many references can we return at most? */
22774  size_t real_maxrefs = maxrefs;
22775  if(real_maxrefs == 0)
22776  real_maxrefs = node->referencesSize;
22777  else if(real_maxrefs > node->referencesSize)
22778  real_maxrefs = node->referencesSize;
22780  if(!result->references) {
22782  goto cleanup;
22783  }
22784 
22785  /* loop over the node's references */
22786  size_t skipped = 0;
22787  UA_Boolean isExternal = false;
22789  for(; referencesIndex < node->referencesSize && referencesCount < real_maxrefs; ++referencesIndex) {
22790  isExternal = false;
22791  const UA_Node *current =
22792  returnRelevantNode(server, descr, all_refs, &node->references[referencesIndex],
22793  relevant_refs, relevant_refs_size, &isExternal);
22794  if(!current)
22795  continue;
22796 
22797  if(skipped < continuationIndex) {
22798  ++skipped;
22799  } else {
22800  retval |= fillReferenceDescription(server->nodestore, current,
22801  &node->references[referencesIndex],
22802  descr->resultMask,
22803  &result->references[referencesCount]);
22804  ++referencesCount;
22805  }
22806  }
22807  result->referencesSize = referencesCount;
22808 
22809  if(referencesCount == 0) {
22810  UA_free(result->references);
22811  result->references = NULL;
22812  result->referencesSize = 0;
22813  }
22814 
22815  if(retval != UA_STATUSCODE_GOOD) {
22816  UA_Array_delete(result->references, result->referencesSize,
22817  &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION]);
22818  result->references = NULL;
22819  result->referencesSize = 0;
22820  result->statusCode = retval;
22821  }
22822 
22823  cleanup:
22824  if(!all_refs && descr->includeSubtypes)
22825  UA_Array_delete(relevant_refs, relevant_refs_size, &UA_TYPES[UA_TYPES_NODEID]);
22826  if(result->statusCode != UA_STATUSCODE_GOOD)
22827  return;
22828 
22829  /* create, update, delete continuation points */
22830  if(cp) {
22831  if(referencesIndex == node->referencesSize) {
22832  /* all done, remove a finished continuationPoint */
22833  removeCp(cp, session);
22834  } else {
22835  /* update the cp and return the cp identifier */
22836  cp->continuationIndex += (UA_UInt32)referencesCount;
22837  UA_ByteString_copy(&cp->identifier, &result->continuationPoint);
22838  }
22839  } else if(maxrefs != 0 && referencesCount >= maxrefs) {
22840  if (session->availableContinuationPoints <= 0) {
22841  // if no more ContinuationPoints are available,
22842  // we delete the last one
22843  LIST_FOREACH(cpLoop, &session->continuationPoints, pointers) {
22844  cpLast = cpLoop;
22845  }
22846 
22847  if (cpLast) {
22848  removeCp(cpLast, session);
22849  }
22850  }
22851 
22852  /* create a cp */
22853  if (session->availableContinuationPoints <= 0 ||
22854  !(cp = UA_malloc(sizeof(struct ContinuationPointEntry)))) {
22856  return;
22857  }
22858  UA_BrowseDescription_copy(descr, &cp->browseDescription);
22859  cp->maxReferences = maxrefs;
22860  cp->continuationIndex = (UA_UInt32) referencesCount;
22861  UA_Guid *ident = UA_Guid_new();
22862  *ident = UA_Guid_random();
22863  cp->identifier.data = (UA_Byte*) ident;
22864  cp->identifier.length = sizeof(UA_Guid);
22865  UA_ByteString_copy(&cp->identifier, &result->continuationPoint);
22866 
22867  /* store the cp */
22868  LIST_INSERT_HEAD(&session->continuationPoints, cp, pointers);
22869  --session->availableContinuationPoints;
22870  }
22871 }
22872 
22873 void Service_Browse(UA_Server *server, UA_Session *session, const UA_BrowseRequest *request,
22874  UA_BrowseResponse *response) {
22875  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing BrowseRequest");
22876  if(!UA_NodeId_isNull(&request->view.viewId)) {
22878  return;
22879  }
22880 
22881  if(request->nodesToBrowseSize <= 0) {
22883  return;
22884  }
22885 
22886  size_t size = request->nodesToBrowseSize;
22887  response->results = UA_Array_new(size, &UA_TYPES[UA_TYPES_BROWSERESULT]);
22888  if(!response->results) {
22890  return;
22891  }
22892  response->resultsSize = size;
22893 
22894 
22895  for(size_t i = 0; i < size; ++i) {
22896  Service_Browse_single(server, session, NULL, &request->nodesToBrowse[i],
22897  request->requestedMaxReferencesPerNode, &response->results[i]);
22898  }
22899 }
22900 
22902 UA_Server_browse(UA_Server *server, UA_UInt32 maxrefs, const UA_BrowseDescription *descr) {
22903  UA_BrowseResult result;
22904  UA_BrowseResult_init(&result);
22905  UA_RCU_LOCK();
22906  Service_Browse_single(server, &adminSession, NULL, descr, maxrefs, &result);
22907  UA_RCU_UNLOCK();
22908  return result;
22909 }
22910 
22911 static void
22912 UA_Server_browseNext_single(UA_Server *server, UA_Session *session, UA_Boolean releaseContinuationPoint,
22913  const UA_ByteString *continuationPoint, UA_BrowseResult *result) {
22915  struct ContinuationPointEntry *cp, *temp;
22916  LIST_FOREACH_SAFE(cp, &session->continuationPoints, pointers, temp) {
22917  if(UA_ByteString_equal(&cp->identifier, continuationPoint)) {
22918  result->statusCode = UA_STATUSCODE_GOOD;
22919  if(!releaseContinuationPoint)
22920  Service_Browse_single(server, session, cp, NULL, 0, result);
22921  else
22922  removeCp(cp, session);
22923  break;
22924  }
22925  }
22926 }
22927 
22928 void Service_BrowseNext(UA_Server *server, UA_Session *session, const UA_BrowseNextRequest *request,
22929  UA_BrowseNextResponse *response) {
22930  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing BrowseNextRequest");
22931  if(request->continuationPointsSize <= 0) {
22933  return;
22934  }
22935  size_t size = request->continuationPointsSize;
22936  response->results = UA_Array_new(size, &UA_TYPES[UA_TYPES_BROWSERESULT]);
22937  if(!response->results) {
22939  return;
22940  }
22941 
22942  response->resultsSize = size;
22943  for(size_t i = 0; i < size; ++i)
22944  UA_Server_browseNext_single(server, session, request->releaseContinuationPoints,
22945  &request->continuationPoints[i], &response->results[i]);
22946 }
22947 
22949 UA_Server_browseNext(UA_Server *server, UA_Boolean releaseContinuationPoint,
22950  const UA_ByteString *continuationPoint) {
22951  UA_BrowseResult result;
22952  UA_BrowseResult_init(&result);
22953  UA_RCU_LOCK();
22954  UA_Server_browseNext_single(server, &adminSession, releaseContinuationPoint,
22955  continuationPoint, &result);
22956  UA_RCU_UNLOCK();
22957  return result;
22958 }
22959 
22960 /***********************/
22961 /* TranslateBrowsePath */
22962 /***********************/
22963 
22964 static void
22965 walkBrowsePathElementNodeReference(UA_BrowsePathResult *result, size_t *targetsSize,
22966  UA_NodeId **next, size_t *nextSize, size_t *nextCount,
22967  UA_UInt32 elemDepth, UA_Boolean inverse, UA_Boolean all_refs,
22968  const UA_NodeId *reftypes, size_t reftypes_count,
22969  const UA_ReferenceNode *reference) {
22970  /* Does the direction of the reference match? */
22971  if(reference->isInverse != inverse)
22972  return;
22973 
22974  /* Is the node relevant? */
22975  if(!all_refs) {
22976  UA_Boolean match = false;
22977  for(size_t j = 0; j < reftypes_count; ++j) {
22978  if(UA_NodeId_equal(&reference->referenceTypeId, &reftypes[j])) {
22979  match = true;
22980  break;
22981  }
22982  }
22983  if(!match)
22984  return;
22985  }
22986 
22987  /* Does the reference point to an external server? Then add to the
22988  * targets with the right path "depth" */
22989  if(reference->targetId.serverIndex != 0) {
22990  UA_BrowsePathTarget *tempTargets =
22991  UA_realloc(result->targets, sizeof(UA_BrowsePathTarget) * (*targetsSize) * 2);
22992  if(!tempTargets) {
22994  return;
22995  }
22996  result->targets = tempTargets;
22997  (*targetsSize) *= 2;
22998  result->statusCode = UA_ExpandedNodeId_copy(&reference->targetId,
22999  &result->targets[result->targetsSize].targetId);
23000  result->targets[result->targetsSize].remainingPathIndex = elemDepth;
23001  return;
23002  }
23003 
23004  /* Add the node to the next array for the following path element */
23005  if(*nextSize <= *nextCount) {
23006  UA_NodeId *tempNext = UA_realloc(*next, sizeof(UA_NodeId) * (*nextSize) * 2);
23007  if(!tempNext) {
23009  return;
23010  }
23011  *next = tempNext;
23012  (*nextSize) *= 2;
23013  }
23014  result->statusCode = UA_NodeId_copy(&reference->targetId.nodeId,
23015  &(*next)[*nextCount]);
23016  ++(*nextCount);
23017 }
23018 
23019 static void
23020 walkBrowsePathElement(UA_Server *server, UA_Session *session,
23021  UA_BrowsePathResult *result, size_t *targetsSize,
23022  const UA_RelativePathElement *elem, UA_UInt32 elemDepth,
23023  const UA_QualifiedName *targetName,
23024  const UA_NodeId *current, const size_t currentCount,
23025  UA_NodeId **next, size_t *nextSize, size_t *nextCount) {
23026  /* Get the full list of relevant referencetypes for this path element */
23027  UA_NodeId *reftypes = NULL;
23028  size_t reftypes_count = 1; // all_refs or no subtypes => 1
23029  UA_Boolean all_refs = false;
23030  if(UA_NodeId_isNull(&elem->referenceTypeId)) {
23031  all_refs = true;
23032  } else if(!elem->includeSubtypes) {
23033  reftypes = (UA_NodeId*)(uintptr_t)&elem->referenceTypeId; // ptr magic due to const cast
23034  } else {
23035  const UA_Node *rootRef = UA_NodeStore_get(server->nodestore, &elem->referenceTypeId);
23036  if(!rootRef || rootRef->nodeClass != UA_NODECLASS_REFERENCETYPE)
23037  return;
23038  UA_StatusCode retval =
23039  getTypeHierarchy(server->nodestore, rootRef, false, &reftypes, &reftypes_count);
23040  if(retval != UA_STATUSCODE_GOOD)
23041  return;
23042  }
23043 
23044  /* Iterate over all nodes at the current depth-level */
23045  for(size_t i = 0; i < currentCount; ++i) {
23046  /* Get the node */
23047  const UA_Node *node = UA_NodeStore_get(server->nodestore, &current[i]);
23048  if(!node) {
23049  /* If we cannot find the node at depth 0, the starting node does not exist */
23050  if(elemDepth == 0)
23052  continue;
23053  }
23054 
23055  /* Test whether the current node has the target name required in the
23056  * previous path element */
23057  if(targetName && (targetName->namespaceIndex != node->browseName.namespaceIndex ||
23058  !UA_String_equal(&targetName->name, &node->browseName.name)))
23059  continue;
23060 
23061  /* Walk over the references in the node */
23062  /* Loop over the nodes references */
23063  for(size_t r = 0; r < node->referencesSize &&
23064  result->statusCode == UA_STATUSCODE_GOOD; ++r) {
23065  UA_ReferenceNode *reference = &node->references[r];
23066  walkBrowsePathElementNodeReference(result, targetsSize, next, nextSize, nextCount,
23067  elemDepth, elem->isInverse, all_refs,
23068  reftypes, reftypes_count, reference);
23069  }
23070  }
23071 
23072  if(!all_refs && elem->includeSubtypes)
23073  UA_Array_delete(reftypes, reftypes_count, &UA_TYPES[UA_TYPES_NODEID]);
23074 }
23075 
23076 /* This assumes that result->targets has enough room for all currentCount elements */
23077 static void
23078 addBrowsePathTargets(UA_Server *server, UA_Session *session, UA_BrowsePathResult *result,
23079  const UA_QualifiedName *targetName, UA_NodeId *current, size_t currentCount) {
23080  for(size_t i = 0; i < currentCount; i++) {
23081  /* Get the node */
23082  const UA_Node *node = UA_NodeStore_get(server->nodestore, &current[i]);
23083  if(!node) {
23084  UA_NodeId_deleteMembers(&current[i]);
23085  continue;
23086  }
23087 
23088  /* Test whether the current node has the target name required in the
23089  * previous path element */
23090  if(targetName->namespaceIndex != node->browseName.namespaceIndex ||
23091  !UA_String_equal(&targetName->name, &node->browseName.name)) {
23092  UA_NodeId_deleteMembers(&current[i]);
23093  continue;
23094  }
23095 
23096  /* Move the nodeid to the target array */
23097  UA_BrowsePathTarget_init(&result->targets[result->targetsSize]);
23098  result->targets[result->targetsSize].targetId.nodeId = current[i];
23100  ++result->targetsSize;
23101  }
23102 }
23103 
23104 static void
23105 walkBrowsePath(UA_Server *server, UA_Session *session, const UA_BrowsePath *path,
23106  UA_BrowsePathResult *result, size_t targetsSize,
23107  UA_NodeId **current, size_t *currentSize, size_t *currentCount,
23108  UA_NodeId **next, size_t *nextSize, size_t *nextCount) {
23109  UA_assert(*currentCount == 1);
23110  UA_assert(*nextCount == 0);
23111 
23112  /* Points to the targetName of the _previous_ path element */
23113  const UA_QualifiedName *targetName = NULL;
23114 
23115  /* Iterate over path elements */
23116  UA_assert(path->relativePath.elementsSize > 0);
23117  for(UA_UInt32 i = 0; i < path->relativePath.elementsSize; ++i) {
23118  walkBrowsePathElement(server, session, result, &targetsSize,
23119  &path->relativePath.elements[i], i, targetName,
23120  *current, *currentCount, next, nextSize, nextCount);
23121 
23122  /* Clean members of current */
23123  for(size_t j = 0; j < *currentCount; j++)
23124  UA_NodeId_deleteMembers(&(*current)[j]);
23125  *currentCount = 0;
23126 
23127  /* When no targets are left or an error occurred. None of next's
23128  * elements will be copied to result->targets */
23129  if(*nextCount == 0 || result->statusCode != UA_STATUSCODE_GOOD) {
23130  UA_assert(*currentCount == 0);
23131  UA_assert(*nextCount == 0);
23132  return;
23133  }
23134 
23135  /* Exchange current and next for the next depth */
23136  size_t tSize = *currentSize; size_t tCount = *currentCount; UA_NodeId *tT = *current;
23137  *currentSize = *nextSize; *currentCount = *nextCount; *current = *next;
23138  *nextSize = tSize; *nextCount = tCount; *next = tT;
23139 
23140  /* Store the target name of the previous path element */
23141  targetName = &path->relativePath.elements[i].targetName;
23142  }
23143 
23144  UA_assert(targetName != NULL);
23145  UA_assert(*nextCount == 0);
23146 
23147  /* After the last BrowsePathElement, move members from current to the
23148  * result targets */
23149 
23150  /* Realloc if more space is needed */
23151  if(targetsSize < result->targetsSize + (*currentCount)) {
23152  UA_BrowsePathTarget *newTargets =
23154  (result->targetsSize + (*currentCount)));
23155  if(!newTargets) {
23157  for(size_t i = 0; i < *currentCount; ++i)
23158  UA_NodeId_deleteMembers(&(*current)[i]);
23159  *currentCount = 0;
23160  return;
23161  }
23162  result->targets = newTargets;
23163  }
23164 
23165  /* Move the elements of current to the targets */
23166  addBrowsePathTargets(server, session, result, targetName, *current, *currentCount);
23167  *currentCount = 0;
23168 }
23169 
23170 static void
23171 translateBrowsePathToNodeIds(UA_Server *server, UA_Session *session,
23172  const UA_BrowsePath *path, UA_BrowsePathResult *result) {
23173  if(path->relativePath.elementsSize <= 0) {
23175  return;
23176  }
23177 
23178  /* RelativePath elements must not have an empty targetName */
23179  for(size_t i = 0; i < path->relativePath.elementsSize; ++i) {
23180  if(UA_QualifiedName_isNull(&path->relativePath.elements[i].targetName)) {
23182  return;
23183  }
23184  }
23185 
23186  /* Allocate memory for the targets */
23187  size_t targetsSize = 10; /* When to realloc; the member count is stored in
23188  * result->targetsSize */
23189  result->targets = (UA_BrowsePathTarget*)UA_malloc(sizeof(UA_BrowsePathTarget) * targetsSize);
23190  if(!result->targets) {
23192  return;
23193  }
23194 
23195  /* Allocate memory for two temporary arrays. One with the results for the
23196  * previous depth of the path. The other for the new results at the current
23197  * depth. The two arrays alternate as we descend down the tree. */
23198  size_t currentSize = 10; /* When to realloc */
23199  size_t currentCount = 0; /* Current elements */
23200  UA_NodeId *current = (UA_NodeId*)UA_malloc(sizeof(UA_NodeId) * currentSize);
23201  if(!current) {
23203  UA_free(result->targets);
23204  return;
23205  }
23206  size_t nextSize = 10; /* When to realloc */
23207  size_t nextCount = 0; /* Current elements */
23208  UA_NodeId *next = (UA_NodeId*)UA_malloc(sizeof(UA_NodeId) * nextSize);
23209  if(!next) {
23211  UA_free(result->targets);
23212  UA_free(current);
23213  return;
23214  }
23215 
23216  /* Copy the starting node into current */
23217  result->statusCode = UA_NodeId_copy(&path->startingNode, &current[0]);
23218  if(result->statusCode != UA_STATUSCODE_GOOD) {
23219  UA_free(result->targets);
23220  UA_free(current);
23221  UA_free(next);
23222  return;
23223  }
23224  currentCount = 1;
23225 
23226  /* Walk the path elements */
23227  walkBrowsePath(server, session, path, result, targetsSize,
23228  &current, &currentSize, &currentCount,
23229  &next, &nextSize, &nextCount);
23230 
23231  UA_assert(currentCount == 0);
23232  UA_assert(nextCount == 0);
23233 
23234  /* No results => BadNoMatch status code */
23235  if(result->targetsSize == 0 && result->statusCode == UA_STATUSCODE_GOOD)
23237 
23238  /* Clean up the temporary arrays and the targets */
23239  UA_free(current);
23240  UA_free(next);
23241  if(result->statusCode != UA_STATUSCODE_GOOD) {
23242  for(size_t i = 0; i < result->targetsSize; ++i)
23243  UA_BrowsePathTarget_deleteMembers(&result->targets[i]);
23244  UA_free(result->targets);
23245  result->targets = NULL;
23246  result->targetsSize = 0;
23247  }
23248 }
23249 
23252  const UA_BrowsePath *browsePath) {
23253  UA_BrowsePathResult result;
23254  UA_BrowsePathResult_init(&result);
23255  UA_RCU_LOCK();
23256  translateBrowsePathToNodeIds(server, &adminSession, browsePath, &result);
23257  UA_RCU_UNLOCK();
23258  return result;
23259 }
23260 
23261 void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session,
23264  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing TranslateBrowsePathsToNodeIdsRequest");
23265  if(request->browsePathsSize <= 0) {
23267  return;
23268  }
23269 
23270  size_t size = request->browsePathsSize;
23272  if(!response->results) {
23274  return;
23275  }
23276 
23277  response->resultsSize = size;
23278  for(size_t i = 0; i < size; ++i)
23279  translateBrowsePathToNodeIds(server, session, &request->browsePaths[i],
23280  &response->results[i]);
23281 
23282 }
23283 
23284 void Service_RegisterNodes(UA_Server *server, UA_Session *session, const UA_RegisterNodesRequest *request,
23285  UA_RegisterNodesResponse *response) {
23286  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing RegisterNodesRequest");
23287  //TODO: hang the nodeids to the session if really needed
23289  if(request->nodesToRegisterSize <= 0)
23291  else {
23292  response->responseHeader.serviceResult =
23294  (void**)&response->registeredNodeIds, &UA_TYPES[UA_TYPES_NODEID]);
23296  response->registeredNodeIdsSize = request->nodesToRegisterSize;
23297  }
23298 }
23299 
23300 void Service_UnregisterNodes(UA_Server *server, UA_Session *session, const UA_UnregisterNodesRequest *request,
23301  UA_UnregisterNodesResponse *response) {
23302  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing UnRegisterNodesRequest");
23303  //TODO: remove the nodeids from the session if really needed
23305  if(request->nodesToUnregisterSize==0)
23307 }
23308 
23309 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_call.c" ***********************************/
23310 
23311 /* This Source Code Form is subject to the terms of the Mozilla Public
23312 * License, v. 2.0. If a copy of the MPL was not distributed with this
23313 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
23314 
23315 
23316 #ifdef UA_ENABLE_METHODCALLS /* conditional compilation */
23317 
23318 static const UA_VariableNode *
23319 getArgumentsVariableNode(UA_Server *server, const UA_MethodNode *ofMethod,
23320  UA_String withBrowseName) {
23321  UA_NodeId hasProperty = UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY);
23322  for(size_t i = 0; i < ofMethod->referencesSize; ++i) {
23323  if(ofMethod->references[i].isInverse == false &&
23324  UA_NodeId_equal(&hasProperty, &ofMethod->references[i].referenceTypeId)) {
23325  const UA_Node *refTarget =
23326  UA_NodeStore_get(server->nodestore, &ofMethod->references[i].targetId.nodeId);
23327  if(!refTarget)
23328  continue;
23329  if(refTarget->nodeClass == UA_NODECLASS_VARIABLE &&
23330  refTarget->browseName.namespaceIndex == 0 &&
23331  UA_String_equal(&withBrowseName, &refTarget->browseName.name)) {
23332  return (const UA_VariableNode*) refTarget;
23333  }
23334  }
23335  }
23336  return NULL;
23337 }
23338 
23339 static UA_StatusCode
23340 argumentsConformsToDefinition(UA_Server *server, const UA_VariableNode *argRequirements,
23341  size_t argsSize, UA_Variant *args) {
23342  if(argRequirements->value.data.value.value.type != &UA_TYPES[UA_TYPES_ARGUMENT])
23344  UA_Argument *argReqs = (UA_Argument*)argRequirements->value.data.value.value.data;
23345  size_t argReqsSize = argRequirements->value.data.value.value.arrayLength;
23346  if(argRequirements->valueSource != UA_VALUESOURCE_DATA)
23348  if(UA_Variant_isScalar(&argRequirements->value.data.value.value))
23349  argReqsSize = 1;
23350  if(argReqsSize > argsSize)
23352  if(argReqsSize != argsSize)
23354 
23356  for(size_t i = 0; i < argReqsSize; ++i)
23357  retval |= typeCheckValue(server, &argReqs[i].dataType, argReqs[i].valueRank,
23358  argReqs[i].arrayDimensionsSize, argReqs[i].arrayDimensions,
23359  &args[i], NULL, &args[i]);
23360  return retval;
23361 }
23362 
23363 void
23364 Service_Call_single(UA_Server *server, UA_Session *session,
23365  const UA_CallMethodRequest *request,
23366  UA_CallMethodResult *result) {
23367  /* Get/verify the method node */
23368  const UA_MethodNode *methodCalled =
23369  (const UA_MethodNode*)UA_NodeStore_get(server->nodestore, &request->methodId);
23370  if(!methodCalled) {
23372  return;
23373  }
23374  if(methodCalled->nodeClass != UA_NODECLASS_METHOD) {
23376  return;
23377  }
23378  if(!methodCalled->executable || !methodCalled->userExecutable || !methodCalled->attachedMethod) {
23379  result->statusCode = UA_STATUSCODE_BADNOTWRITABLE; // There is no NOTEXECUTABLE?
23380  return;
23381  }
23382 
23383  /* Get/verify the object node */
23384  const UA_ObjectNode *withObject =
23385  (const UA_ObjectNode*)UA_NodeStore_get(server->nodestore, &request->objectId);
23386  if(!withObject) {
23388  return;
23389  }
23390  if(withObject->nodeClass != UA_NODECLASS_OBJECT && withObject->nodeClass != UA_NODECLASS_OBJECTTYPE) {
23392  return;
23393  }
23394 
23395  /* Verify method/object relations. Object must have a hasComponent or a
23396  * subtype of hasComponent reference to the method node. Therefore, check
23397  * every reference between the parent object and the method node if there is
23398  * a hasComponent (or subtype) reference */
23399  UA_Boolean found = false;
23400  UA_NodeId hasComponentNodeId = UA_NODEID_NUMERIC(0,UA_NS0ID_HASCOMPONENT);
23401  UA_NodeId hasSubTypeNodeId = UA_NODEID_NUMERIC(0,UA_NS0ID_HASSUBTYPE);
23402  for(size_t i = 0; i < methodCalled->referencesSize; ++i) {
23403  if(methodCalled->references[i].isInverse &&
23404  UA_NodeId_equal(&methodCalled->references[i].targetId.nodeId, &withObject->nodeId)) {
23405  found = isNodeInTree(server->nodestore, &methodCalled->references[i].referenceTypeId,
23406  &hasComponentNodeId, &hasSubTypeNodeId, 1);
23407  if(found)
23408  break;
23409  }
23410  }
23411  if(!found) {
23413  return;
23414  }
23415 
23416  /* Verify Input Argument count, types and sizes */
23417  const UA_VariableNode *inputArguments =
23418  getArgumentsVariableNode(server, methodCalled, UA_STRING("InputArguments"));
23419 
23420  if(!inputArguments) {
23421  if(request->inputArgumentsSize > 0) {
23423  return;
23424  }
23425  } else {
23426  result->statusCode = argumentsConformsToDefinition(server, inputArguments,
23427  request->inputArgumentsSize,
23428  request->inputArguments);
23429  if(result->statusCode != UA_STATUSCODE_GOOD)
23430  return;
23431  }
23432 
23433  /* Allocate the output arguments */
23434  result->outputArgumentsSize = 0; /* the default */
23435  const UA_VariableNode *outputArguments =
23436  getArgumentsVariableNode(server, methodCalled, UA_STRING("OutputArguments"));
23437  if(outputArguments) {
23438  result->outputArguments = UA_Array_new(outputArguments->value.data.value.value.arrayLength,
23440  if(!result->outputArguments) {
23442  return;
23443  }
23444  result->outputArgumentsSize = outputArguments->value.data.value.value.arrayLength;
23445  }
23446 
23447  /* Call the method */
23448 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
23449  methodCallSession = session;
23450 #endif
23451  result->statusCode = methodCalled->attachedMethod(methodCalled->methodHandle, withObject->nodeId,
23452  request->inputArgumentsSize, request->inputArguments,
23453  result->outputArgumentsSize, result->outputArguments);
23454 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
23455  methodCallSession = NULL;
23456 #endif
23457 
23458  /* TODO: Verify Output matches the argument definition */
23459 }
23460 
23461 void Service_Call(UA_Server *server, UA_Session *session,
23462  const UA_CallRequest *request,
23463  UA_CallResponse *response) {
23464  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing CallRequest");
23465  if(request->methodsToCallSize <= 0) {
23467  return;
23468  }
23469 
23471  if(!response->results) {
23473  return;
23474  }
23475  response->resultsSize = request->methodsToCallSize;
23476 
23477 
23478  for(size_t i = 0; i < request->methodsToCallSize;++i){
23479  Service_Call_single(server, session, &request->methodsToCall[i], &response->results[i]);
23480  }
23481 }
23482 
23484 UA_Server_call(UA_Server *server, const UA_CallMethodRequest *request) {
23485  UA_CallMethodResult result;
23486  UA_CallMethodResult_init(&result);
23487  Service_Call_single(server, &adminSession,
23488  request, &result);
23489  return result;
23490 }
23491 
23492 #endif /* UA_ENABLE_METHODCALLS */
23493 
23494 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_subscription.c" ***********************************/
23495 
23496 /* This Source Code Form is subject to the terms of the Mozilla Public
23497 * License, v. 2.0. If a copy of the MPL was not distributed with this
23498 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
23499 
23500 
23501 #ifdef UA_ENABLE_SUBSCRIPTIONS /* conditional compilation */
23502 
23503 #define UA_VALUENCODING_MAXSTACK 512
23504 
23505 /*****************/
23506 /* MonitoredItem */
23507 /*****************/
23508 
23511  if(!new)
23512  return NULL;
23513  new->subscription = NULL;
23514  new->currentQueueSize = 0;
23515  new->maxQueueSize = 0;
23516  new->monitoredItemType = UA_MONITOREDITEMTYPE_CHANGENOTIFY; /* currently hardcoded */
23517  new->timestampsToReturn = UA_TIMESTAMPSTORETURN_SOURCE;
23518  UA_String_init(&new->indexRange);
23519  TAILQ_INIT(&new->queue);
23520  UA_NodeId_init(&new->monitoredNodeId);
23521  new->lastSampledValue = UA_BYTESTRING_NULL;
23522  memset(&new->sampleJobGuid, 0, sizeof(UA_Guid));
23523  new->sampleJobIsRegistered = false;
23524  new->itemId = 0;
23525  return new;
23526 }
23527 
23528 void MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem) {
23529  MonitoredItem_unregisterSampleJob(server, monitoredItem);
23530  /* clear the queued samples */
23531  MonitoredItem_queuedValue *val, *val_tmp;
23532  TAILQ_FOREACH_SAFE(val, &monitoredItem->queue, listEntry, val_tmp) {
23533  TAILQ_REMOVE(&monitoredItem->queue, val, listEntry);
23534  UA_DataValue_deleteMembers(&val->value);
23535  UA_free(val);
23536  }
23537  monitoredItem->currentQueueSize = 0;
23538  LIST_REMOVE(monitoredItem, listEntry);
23539  UA_String_deleteMembers(&monitoredItem->indexRange);
23540  UA_ByteString_deleteMembers(&monitoredItem->lastSampledValue);
23541  UA_NodeId_deleteMembers(&monitoredItem->monitoredNodeId);
23542  UA_free(monitoredItem);
23543 }
23544 
23545 static void
23546 ensureSpaceInMonitoredItemQueue(UA_MonitoredItem *mon) {
23547  if(mon->currentQueueSize < mon->maxQueueSize)
23548  return;
23549  MonitoredItem_queuedValue *queueItem;
23550  if(mon->discardOldest)
23551  queueItem = TAILQ_FIRST(&mon->queue);
23552  else
23553  queueItem = TAILQ_LAST(&mon->queue, QueueOfQueueDataValues);
23554  UA_assert(queueItem); /* When the currentQueueSize > 0, then there is an item */
23555  TAILQ_REMOVE(&mon->queue, queueItem, listEntry);
23556  UA_DataValue_deleteMembers(&queueItem->value);
23557  UA_free(queueItem);
23558  --mon->currentQueueSize;
23559 }
23560 
23561 /* Has this sample changed from the last one? The method may allocate additional
23562  * space for the encoding buffer. Detect the change in encoding->data. */
23563 static UA_StatusCode
23564 detectValueChange(UA_MonitoredItem *mon, UA_DataValue *value,
23565  UA_ByteString *encoding, UA_Boolean *changed) {
23566  /* Apply Filter */
23567  UA_Boolean hasValue = value->hasValue;
23568  if(mon->trigger == UA_DATACHANGETRIGGER_STATUS)
23569  value->hasValue = false;
23570 
23571  UA_Boolean hasServerTimestamp = value->hasServerTimestamp;
23572  UA_Boolean hasServerPicoseconds = value->hasServerPicoseconds;
23573  value->hasServerTimestamp = false;
23574  value->hasServerPicoseconds = false;
23575 
23576  UA_Boolean hasSourceTimestamp = value->hasSourceTimestamp;
23577  UA_Boolean hasSourcePicoseconds = value->hasSourcePicoseconds;
23578  if(mon->trigger < UA_DATACHANGETRIGGER_STATUSVALUETIMESTAMP) {
23579  value->hasSourceTimestamp = false;
23580  value->hasSourcePicoseconds = false;
23581  }
23582 
23583  /* Encode the data for comparison */
23585  size_t binsize = UA_calcSizeBinary(value, &UA_TYPES[UA_TYPES_DATAVALUE]);
23586  if(binsize == 0) {
23588  goto cleanup;
23589  }
23590 
23591  /* Allocate buffer on the heap if necessary */
23592  if(binsize > UA_VALUENCODING_MAXSTACK &&
23593  UA_ByteString_allocBuffer(encoding, binsize) != UA_STATUSCODE_GOOD) {
23595  goto cleanup;
23596  }
23597 
23598  /* Encode the value */
23599  size_t encodingOffset = 0;
23600  retval = UA_encodeBinary(value, &UA_TYPES[UA_TYPES_DATAVALUE],
23601  NULL, NULL, encoding, &encodingOffset);
23602  if(retval != UA_STATUSCODE_GOOD)
23603  goto cleanup;
23604 
23605  /* The value has changed */
23606  encoding->length = encodingOffset;
23607  if(!mon->lastSampledValue.data || !UA_String_equal(encoding, &mon->lastSampledValue))
23608  *changed = true;
23609 
23610  cleanup:
23611  /* Reset the filter */
23612  value->hasValue = hasValue;
23613  value->hasServerTimestamp = hasServerTimestamp;
23614  value->hasServerPicoseconds = hasServerPicoseconds;
23615  value->hasSourceTimestamp = hasSourceTimestamp;
23616  value->hasSourcePicoseconds = hasSourcePicoseconds;
23617  return retval;
23618 }
23619 
23620 void UA_MoniteredItem_SampleCallback(UA_Server *server, UA_MonitoredItem *monitoredItem) {
23621  UA_Subscription *sub = monitoredItem->subscription;
23622  if(monitoredItem->monitoredItemType != UA_MONITOREDITEMTYPE_CHANGENOTIFY) {
23623  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
23624  "Subscription %u | MonitoredItem %i | "
23625  "Not a data change notification",
23626  sub->subscriptionID, monitoredItem->itemId);
23627  return;
23628  }
23629 
23630  /* Read the value */
23631  UA_ReadValueId rvid;
23632  UA_ReadValueId_init(&rvid);
23633  rvid.nodeId = monitoredItem->monitoredNodeId;
23634  rvid.attributeId = monitoredItem->attributeID;
23635  rvid.indexRange = monitoredItem->indexRange;
23636  UA_DataValue value;
23637  UA_DataValue_init(&value);
23638  Service_Read_single(server, sub->session, monitoredItem->timestampsToReturn,
23639  &rvid, &value);
23640 
23641  /* Stack-allocate some memory for the value encoding */
23642  UA_Byte *stackValueEncoding = UA_alloca(UA_VALUENCODING_MAXSTACK);
23643  UA_ByteString valueEncoding;
23644  valueEncoding.data = stackValueEncoding;
23645  valueEncoding.length = UA_VALUENCODING_MAXSTACK;
23646 
23647  /* Has the value changed? */
23648  UA_Boolean changed = false;
23649  UA_StatusCode retval = detectValueChange(monitoredItem, &value,
23650  &valueEncoding, &changed);
23651  if(!changed || retval != UA_STATUSCODE_GOOD)
23652  goto cleanup;
23653 
23654  /* Allocate the entry for the publish queue */
23656  if(!newQueueItem) {
23657  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23658  "Subscription %u | MonitoredItem %i | "
23659  "Item for the publishing queue could not be allocated",
23660  sub->subscriptionID, monitoredItem->itemId);
23661  goto cleanup;
23662  }
23663 
23664  /* Copy valueEncoding on the heap for the next comparison (if not already done) */
23665  if(valueEncoding.data == stackValueEncoding) {
23666  UA_ByteString cbs;
23667  if(UA_ByteString_copy(&valueEncoding, &cbs) != UA_STATUSCODE_GOOD) {
23668  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23669  "Subscription %u | MonitoredItem %i | "
23670  "ByteString to compare values could not be created",
23671  sub->subscriptionID, monitoredItem->itemId);
23672  UA_free(newQueueItem);
23673  goto cleanup;
23674  }
23675  valueEncoding = cbs;
23676  }
23677 
23678  /* Prepare the newQueueItem */
23679  if(value.hasValue && value.value.storageType == UA_VARIANT_DATA_NODELETE) {
23680  if(UA_DataValue_copy(&value, &newQueueItem->value) != UA_STATUSCODE_GOOD) {
23681  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23682  "Subscription %u | MonitoredItem %i | "
23683  "Item for the publishing queue could not be prepared",
23684  sub->subscriptionID, monitoredItem->itemId);
23685  UA_free(newQueueItem);
23686  goto cleanup;
23687  }
23688  } else {
23689  newQueueItem->value = value;
23690  }
23691  newQueueItem->clientHandle = monitoredItem->clientHandle;
23692 
23693  /* <-- Point of no return --> */
23694 
23695  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
23696  "Subscription %u | MonitoredItem %u | Sampled a new value",
23697  sub->subscriptionID, monitoredItem->itemId);
23698 
23699  /* Replace the encoding for comparison */
23700  UA_ByteString_deleteMembers(&monitoredItem->lastSampledValue);
23701  monitoredItem->lastSampledValue = valueEncoding;
23702 
23703  /* Add the sample to the queue for publication */
23704  ensureSpaceInMonitoredItemQueue(monitoredItem);
23705  TAILQ_INSERT_TAIL(&monitoredItem->queue, newQueueItem, listEntry);
23706  ++monitoredItem->currentQueueSize;
23707  return;
23708 
23709  cleanup:
23710  if(valueEncoding.data != stackValueEncoding)
23711  UA_ByteString_deleteMembers(&valueEncoding);
23712  UA_DataValue_deleteMembers(&value);
23713 }
23714 
23716 MonitoredItem_registerSampleJob(UA_Server *server, UA_MonitoredItem *mon) {
23717  UA_Job job;
23718  job.type = UA_JOBTYPE_METHODCALL;
23719  job.job.methodCall.method = (UA_ServerCallback)UA_MoniteredItem_SampleCallback;
23720  job.job.methodCall.data = mon;
23721  UA_StatusCode retval = UA_Server_addRepeatedJob(server, job,
23722  (UA_UInt32)mon->samplingInterval,
23723  &mon->sampleJobGuid);
23724  if(retval == UA_STATUSCODE_GOOD)
23725  mon->sampleJobIsRegistered = true;
23726  return retval;
23727 }
23728 
23730  if(!mon->sampleJobIsRegistered)
23731  return UA_STATUSCODE_GOOD;
23732  mon->sampleJobIsRegistered = false;
23733  return UA_Server_removeRepeatedJob(server, mon->sampleJobGuid);
23734 }
23735 
23736 /****************/
23737 /* Subscription */
23738 /****************/
23739 
23740 UA_Subscription * UA_Subscription_new(UA_Session *session, UA_UInt32 subscriptionID) {
23741  UA_Subscription *new = UA_malloc(sizeof(UA_Subscription));
23742  if(!new)
23743  return NULL;
23744  new->session = session;
23745  new->subscriptionID = subscriptionID;
23746  new->sequenceNumber = 0;
23747  new->maxKeepAliveCount = 0;
23748  new->publishingEnabled = false;
23749  memset(&new->publishJobGuid, 0, sizeof(UA_Guid));
23750  new->publishJobIsRegistered = false;
23751  new->currentKeepAliveCount = 0;
23752  new->currentLifetimeCount = 0;
23753  new->lastMonitoredItemId = 0;
23754  new->state = UA_SUBSCRIPTIONSTATE_NORMAL; /* The first publish response is sent immediately */
23755  LIST_INIT(&new->monitoredItems);
23756  TAILQ_INIT(&new->retransmissionQueue);
23757  new->retransmissionQueueSize = 0;
23758  return new;
23759 }
23760 
23761 void UA_Subscription_deleteMembers(UA_Subscription *subscription, UA_Server *server) {
23762  Subscription_unregisterPublishJob(server, subscription);
23763 
23764  /* Delete monitored Items */
23765  UA_MonitoredItem *mon, *tmp_mon;
23766  LIST_FOREACH_SAFE(mon, &subscription->monitoredItems, listEntry, tmp_mon) {
23767  LIST_REMOVE(mon, listEntry);
23768  MonitoredItem_delete(server, mon);
23769  }
23770 
23771  /* Delete Retransmission Queue */
23772  UA_NotificationMessageEntry *nme, *nme_tmp;
23773  TAILQ_FOREACH_SAFE(nme, &subscription->retransmissionQueue, listEntry, nme_tmp) {
23774  TAILQ_REMOVE(&subscription->retransmissionQueue, nme, listEntry);
23775  UA_NotificationMessage_deleteMembers(&nme->message);
23776  UA_free(nme);
23777  }
23778  subscription->retransmissionQueueSize = 0;
23779 }
23780 
23783  UA_MonitoredItem *mon;
23784  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
23785  if(mon->itemId == monitoredItemID)
23786  break;
23787  }
23788  return mon;
23789 }
23790 
23793  UA_UInt32 monitoredItemID) {
23794  UA_MonitoredItem *mon;
23795  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
23796  if(mon->itemId == monitoredItemID) {
23797  LIST_REMOVE(mon, listEntry);
23798  MonitoredItem_delete(server, mon);
23799  return UA_STATUSCODE_GOOD;
23800  }
23801  }
23803 }
23804 
23805 static size_t
23806 countQueuedNotifications(UA_Subscription *sub, UA_Boolean *moreNotifications) {
23807  size_t notifications = 0;
23808  if(sub->publishingEnabled) {
23809  UA_MonitoredItem *mon;
23810  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
23812  TAILQ_FOREACH(qv, &mon->queue, listEntry) {
23813  if(notifications >= sub->notificationsPerPublish) {
23814  *moreNotifications = true;
23815  break;
23816  }
23817  ++notifications;
23818  }
23819  }
23820  }
23821  return notifications;
23822 }
23823 
23824 static void
23825 UA_Subscription_addRetransmissionMessage(UA_Server *server, UA_Subscription *sub,
23826  UA_NotificationMessageEntry *entry) {
23827  /* Release the oldest entry if there is not enough space */
23828  if(server->config.maxRetransmissionQueueSize > 0 &&
23829  sub->retransmissionQueueSize >= server->config.maxRetransmissionQueueSize) {
23830  UA_NotificationMessageEntry *lastentry =
23831  TAILQ_LAST(&sub->retransmissionQueue, UA_ListOfNotificationMessages);
23832  TAILQ_REMOVE(&sub->retransmissionQueue, lastentry, listEntry);
23833  --sub->retransmissionQueueSize;
23834  UA_NotificationMessage_deleteMembers(&lastentry->message);
23835  UA_free(lastentry);
23836  }
23837 
23838  /* Add entry */
23839  TAILQ_INSERT_HEAD(&sub->retransmissionQueue, entry, listEntry);
23840  ++sub->retransmissionQueueSize;
23841 }
23842 
23845  UA_NotificationMessageEntry *entry, *entry_tmp;
23846  TAILQ_FOREACH_SAFE(entry, &sub->retransmissionQueue, listEntry, entry_tmp) {
23847  if(entry->message.sequenceNumber != sequenceNumber)
23848  continue;
23849  TAILQ_REMOVE(&sub->retransmissionQueue, entry, listEntry);
23850  --sub->retransmissionQueueSize;
23851  UA_NotificationMessage_deleteMembers(&entry->message);
23852  UA_free(entry);
23853  return UA_STATUSCODE_GOOD;
23854  }
23856 }
23857 
23858 static UA_StatusCode
23859 prepareNotificationMessage(UA_Subscription *sub, UA_NotificationMessage *message,
23860  size_t notifications) {
23861  /* Array of ExtensionObject to hold different kinds of notifications
23862  (currently only DataChangeNotifications) */
23864  if(!message->notificationData)
23866  message->notificationDataSize = 1;
23867 
23868  /* Allocate Notification */
23869  UA_DataChangeNotification *dcn = UA_DataChangeNotification_new();
23870  if(!dcn)
23871  goto cleanup;
23872  UA_ExtensionObject *data = message->notificationData;
23874  data->content.decoded.data = dcn;
23876 
23877  /* Allocate array of notifications */
23878  dcn->monitoredItems =
23880  if(!dcn->monitoredItems)
23881  goto cleanup;
23882  dcn->monitoredItemsSize = notifications;
23883 
23884  /* Move notifications into the response .. the point of no return */
23885  size_t l = 0;
23886  UA_MonitoredItem *mon;
23887  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
23888  MonitoredItem_queuedValue *qv, *qv_tmp;
23889  TAILQ_FOREACH_SAFE(qv, &mon->queue, listEntry, qv_tmp) {
23890  if(l >= notifications)
23891  return UA_STATUSCODE_GOOD;
23893  min->clientHandle = qv->clientHandle;
23894  min->value = qv->value;
23895  TAILQ_REMOVE(&mon->queue, qv, listEntry);
23896  UA_free(qv);
23897  --mon->currentQueueSize;
23898  ++l;
23899  }
23900  }
23901  return UA_STATUSCODE_GOOD;
23902 
23903  cleanup:
23904  UA_NotificationMessage_deleteMembers(message);
23906 }
23907 
23908 void UA_Subscription_publishCallback(UA_Server *server, UA_Subscription *sub) {
23909  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, "Subscription %u | "
23910  "Publish Callback", sub->subscriptionID);
23911 
23912  /* Count the available notifications */
23913  UA_Boolean moreNotifications = false;
23914  size_t notifications = countQueuedNotifications(sub, &moreNotifications);
23915 
23916  /* Return if nothing to do */
23917  if(notifications == 0) {
23918  ++sub->currentKeepAliveCount;
23919  if(sub->currentKeepAliveCount < sub->maxKeepAliveCount)
23920  return;
23921  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
23922  "Subscription %u | Sending a KeepAlive",
23923  sub->subscriptionID)
23924  }
23925 
23926  /* Check if the securechannel is valid */
23927  UA_SecureChannel *channel = sub->session->channel;
23928  if(!channel)
23929  return;
23930 
23931  /* Dequeue a response */
23932  UA_PublishResponseEntry *pre = SIMPLEQ_FIRST(&sub->session->responseQueue);
23933 
23934  /* Cannot publish without a response */
23935  if(!pre) {
23936  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
23937  "Subscription %u | Cannot send a publish response "
23938  "since the publish queue is empty", sub->subscriptionID)
23939  if(sub->state != UA_SUBSCRIPTIONSTATE_LATE) {
23940  sub->state = UA_SUBSCRIPTIONSTATE_LATE;
23941  } else {
23942  ++sub->currentLifetimeCount;
23943  if(sub->currentLifetimeCount > sub->lifeTimeCount) {
23944  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, "Subscription %u | "
23945  "End of lifetime for subscription", sub->subscriptionID);
23946  UA_Session_deleteSubscription(server, sub->session, sub->subscriptionID);
23947  }
23948  }
23949  return;
23950  }
23951 
23952  UA_PublishResponse *response = &pre->response;
23953  UA_NotificationMessage *message = &response->notificationMessage;
23954  UA_NotificationMessageEntry *retransmission = NULL;
23955  if(notifications > 0) {
23956  /* Allocate the retransmission entry */
23957  retransmission = UA_malloc(sizeof(UA_NotificationMessageEntry));
23958  if(!retransmission) {
23959  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23960  "Subscription %u | Could not allocate memory "
23961  "for retransmission", sub->subscriptionID);
23962  return;
23963  }
23964  /* Prepare the response */
23965  UA_StatusCode retval =
23966  prepareNotificationMessage(sub, message, notifications);
23967  if(retval != UA_STATUSCODE_GOOD) {
23968  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23969  "Subscription %u | Could not prepare the "
23970  "notification message", sub->subscriptionID);
23971  UA_free(retransmission);
23972  return;
23973  }
23974  }
23975 
23976  /* <-- The point of no return --> */
23977 
23978  /* Remove the response from the response queue */
23979  SIMPLEQ_REMOVE_HEAD(&sub->session->responseQueue, listEntry);
23980 
23981  /* Set up the response */
23983  response->subscriptionId = sub->subscriptionID;
23984  response->moreNotifications = moreNotifications;
23985  message->publishTime = response->responseHeader.timestamp;
23986  if(notifications == 0) {
23987  /* Send sequence number for the next notification */
23988  message->sequenceNumber = sub->sequenceNumber + 1;
23989  } else {
23990  /* Increase the sequence number */
23991  message->sequenceNumber = ++sub->sequenceNumber;
23992 
23993  /* Put the notification message into the retransmission queue. This needs to
23994  * be done here, so that the message itself is included in the available
23995  * sequence numbers for acknowledgement. */
23996  retransmission->message = response->notificationMessage;
23997  UA_Subscription_addRetransmissionMessage(server, sub, retransmission);
23998  }
23999 
24000  /* Get the available sequence numbers from the retransmission queue */
24001  size_t available = sub->retransmissionQueueSize;
24002  if(available > 0) {
24003  response->availableSequenceNumbers = UA_alloca(available * sizeof(UA_UInt32));
24004  response->availableSequenceNumbersSize = available;
24005  size_t i = 0;
24007  TAILQ_FOREACH(nme, &sub->retransmissionQueue, listEntry) {
24008  response->availableSequenceNumbers[i] = nme->message.sequenceNumber;
24009  ++i;
24010  }
24011  }
24012 
24013  /* Send the response */
24014  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
24015  "Subscription %u | Sending out a publish response with %u "
24016  "notifications", sub->subscriptionID, (UA_UInt32)notifications);
24017  UA_SecureChannel_sendBinaryMessage(sub->session->channel, pre->requestId, response,
24019 
24020  /* Reset subscription state to normal. */
24021  sub->state = UA_SUBSCRIPTIONSTATE_NORMAL;
24022  sub->currentKeepAliveCount = 0;
24023  sub->currentLifetimeCount = 0;
24024 
24025  /* Free the response */
24026  UA_Array_delete(response->results, response->resultsSize,
24028  UA_free(pre); /* no need for UA_PublishResponse_deleteMembers */
24029 
24030  /* Repeat if there are more notifications to send */
24031  if(moreNotifications)
24032  UA_Subscription_publishCallback(server, sub);
24033 }
24034 
24036 Subscription_registerPublishJob(UA_Server *server, UA_Subscription *sub) {
24037  if(sub->publishJobIsRegistered)
24038  return UA_STATUSCODE_GOOD;
24039 
24040  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
24041  "Subscription %u | Register subscription publishing callback",
24042  sub->subscriptionID);
24043  UA_Job job;
24044  job.type = UA_JOBTYPE_METHODCALL;
24045  job.job.methodCall.method = (UA_ServerCallback)UA_Subscription_publishCallback;
24046  job.job.methodCall.data = sub;
24047  UA_StatusCode retval =
24048  UA_Server_addRepeatedJob(server, job, (UA_UInt32)sub->publishingInterval,
24049  &sub->publishJobGuid);
24050  if(retval == UA_STATUSCODE_GOOD)
24051  sub->publishJobIsRegistered = true;
24052  return retval;
24053 }
24054 
24056 Subscription_unregisterPublishJob(UA_Server *server, UA_Subscription *sub) {
24057  if(!sub->publishJobIsRegistered)
24058  return UA_STATUSCODE_GOOD;
24059  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
24060  "Subscription %u | Unregister subscription publishing callback",
24061  sub->subscriptionID);
24062  sub->publishJobIsRegistered = false;
24063  return UA_Server_removeRepeatedJob(server, sub->publishJobGuid);
24064 }
24065 
24066 /* When the session has publish requests stored but the last subscription is
24067  deleted... Send out empty responses */
24068 void
24069 UA_Subscription_answerPublishRequestsNoSubscription(UA_Server *server, UA_NodeId *sessionToken) {
24070  /* Get session */
24071  UA_Session *session = UA_SessionManager_getSession(&server->sessionManager, sessionToken);
24072  UA_NodeId_delete(sessionToken);
24073 
24074  /* No session or there are remaining subscriptions */
24075  if(!session || LIST_FIRST(&session->serverSubscriptions))
24076  return;
24077 
24078  /* Send a response for every queued request */
24079  UA_PublishResponseEntry *pre;
24080  while((pre = SIMPLEQ_FIRST(&session->responseQueue))) {
24081  SIMPLEQ_REMOVE_HEAD(&session->responseQueue, listEntry);
24082  UA_PublishResponse *response = &pre->response;
24085  UA_SecureChannel_sendBinaryMessage(session->channel, pre->requestId, response,
24087  UA_PublishResponse_deleteMembers(response);
24088  UA_free(pre);
24089  }
24090 }
24091 
24092 #endif /* UA_ENABLE_SUBSCRIPTIONS */
24093 
24094 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_subscription.c" ***********************************/
24095 
24096 /* This Source Code Form is subject to the terms of the Mozilla Public
24097 * License, v. 2.0. If a copy of the MPL was not distributed with this
24098 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
24099 
24100 
24101 #ifdef UA_ENABLE_SUBSCRIPTIONS /* conditional compilation */
24102 
24103 #define UA_BOUNDEDVALUE_SETWBOUNDS(BOUNDS, SRC, DST) { \
24104  if(SRC > BOUNDS.max) DST = BOUNDS.max; \
24105  else if(SRC < BOUNDS.min) DST = BOUNDS.min; \
24106  else DST = SRC; \
24107  }
24108 
24109 static void
24110 setSubscriptionSettings(UA_Server *server, UA_Subscription *subscription,
24111  UA_Double requestedPublishingInterval,
24112  UA_UInt32 requestedLifetimeCount,
24113  UA_UInt32 requestedMaxKeepAliveCount,
24114  UA_UInt32 maxNotificationsPerPublish, UA_Byte priority) {
24115  /* deregister the job if required */
24116  UA_StatusCode retval = Subscription_unregisterPublishJob(server, subscription);
24117  if(retval != UA_STATUSCODE_GOOD)
24118  UA_LOG_DEBUG_SESSION(server->config.logger, subscription->session, "Subscription %u | "
24119  "Could not unregister publish job with error code 0x%08x",
24120  subscription->subscriptionID, retval);
24121 
24122  /* re-parameterize the subscription */
24123  subscription->publishingInterval = requestedPublishingInterval;
24124  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.publishingIntervalLimits,
24125  requestedPublishingInterval, subscription->publishingInterval);
24126  /* check for nan*/
24127  if(requestedPublishingInterval != requestedPublishingInterval)
24128  subscription->publishingInterval = server->config.publishingIntervalLimits.min;
24129  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.keepAliveCountLimits,
24130  requestedMaxKeepAliveCount, subscription->maxKeepAliveCount);
24131  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.lifeTimeCountLimits,
24132  requestedLifetimeCount, subscription->lifeTimeCount);
24133  if(subscription->lifeTimeCount < 3 * subscription->maxKeepAliveCount)
24134  subscription->lifeTimeCount = 3 * subscription->maxKeepAliveCount;
24135  subscription->notificationsPerPublish = maxNotificationsPerPublish;
24136  if(maxNotificationsPerPublish == 0 ||
24137  maxNotificationsPerPublish > server->config.maxNotificationsPerPublish)
24138  subscription->notificationsPerPublish = server->config.maxNotificationsPerPublish;
24139  subscription->priority = priority;
24140 
24141  retval = Subscription_registerPublishJob(server, subscription);
24142  if(retval != UA_STATUSCODE_GOOD)
24143  UA_LOG_DEBUG_SESSION(server->config.logger, subscription->session, "Subscription %u | "
24144  "Could not register publish job with error code 0x%08x",
24145  subscription->subscriptionID, retval);
24146 }
24147 
24148 void
24149 Service_CreateSubscription(UA_Server *server, UA_Session *session,
24150  const UA_CreateSubscriptionRequest *request,
24151  UA_CreateSubscriptionResponse *response) {
24152  /* Create the subscription */
24153  UA_Subscription *newSubscription = UA_Subscription_new(session, response->subscriptionId);
24154  if(!newSubscription) {
24155  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24156  "Processing CreateSubscriptionRequest failed");
24158  return;
24159  }
24160  newSubscription->subscriptionID = UA_Session_getUniqueSubscriptionID(session);
24161  UA_Session_addSubscription(session, newSubscription);
24162 
24163  /* Set the subscription parameters */
24164  newSubscription->publishingEnabled = request->publishingEnabled;
24165  setSubscriptionSettings(server, newSubscription, request->requestedPublishingInterval,
24167  request->maxNotificationsPerPublish, request->priority);
24168  newSubscription->currentKeepAliveCount = newSubscription->maxKeepAliveCount; /* set settings first */
24169 
24170  /* Prepare the response */
24171  response->subscriptionId = newSubscription->subscriptionID;
24172  response->revisedPublishingInterval = newSubscription->publishingInterval;
24173  response->revisedLifetimeCount = newSubscription->lifeTimeCount;
24174  response->revisedMaxKeepAliveCount = newSubscription->maxKeepAliveCount;
24175 
24176  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24177  "CreateSubscriptionRequest: Created Subscription %u "
24178  "with a publishing interval of %f ms", response->subscriptionId,
24179  newSubscription->publishingInterval);
24180 }
24181 
24182 void
24183 Service_ModifySubscription(UA_Server *server, UA_Session *session,
24184  const UA_ModifySubscriptionRequest *request,
24185  UA_ModifySubscriptionResponse *response) {
24186  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24187  "Processing ModifySubscriptionRequest");
24188  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24189  if(!sub) {
24191  return;
24192  }
24193 
24194  setSubscriptionSettings(server, sub, request->requestedPublishingInterval,
24196  request->maxNotificationsPerPublish, request->priority);
24197  sub->currentLifetimeCount = 0; /* Reset the subscription lifetime */
24198  response->revisedPublishingInterval = sub->publishingInterval;
24199  response->revisedLifetimeCount = sub->lifeTimeCount;
24200  response->revisedMaxKeepAliveCount = sub->maxKeepAliveCount;
24201 }
24202 
24203 void
24204 Service_SetPublishingMode(UA_Server *server, UA_Session *session,
24205  const UA_SetPublishingModeRequest *request,
24206  UA_SetPublishingModeResponse *response) {
24207  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24208  "Processing SetPublishingModeRequest");
24209  if(request->subscriptionIdsSize <= 0) {
24211  return;
24212  }
24213 
24214  size_t size = request->subscriptionIdsSize;
24215  response->results = UA_Array_new(size, &UA_TYPES[UA_TYPES_STATUSCODE]);
24216  if(!response->results) {
24218  return;
24219  }
24220 
24221  response->resultsSize = size;
24222  for(size_t i = 0; i < size; ++i) {
24223  UA_Subscription *sub =
24224  UA_Session_getSubscriptionByID(session, request->subscriptionIds[i]);
24225  if(!sub) {
24227  continue;
24228  }
24229  if(sub->publishingEnabled != request->publishingEnabled) {
24230  sub->publishingEnabled = request->publishingEnabled;
24231  sub->currentLifetimeCount = 0; /* Reset the subscription lifetime */
24232  }
24233  }
24234 }
24235 
24236 static void
24237 setMonitoredItemSettings(UA_Server *server, UA_MonitoredItem *mon,
24238  UA_MonitoringMode monitoringMode,
24239  const UA_MonitoringParameters *params) {
24240  MonitoredItem_unregisterSampleJob(server, mon);
24241  mon->monitoringMode = monitoringMode;
24242 
24243  /* ClientHandle */
24244  mon->clientHandle = params->clientHandle;
24245 
24246  /* SamplingInterval */
24247  UA_Double samplingInterval = params->samplingInterval;
24248  if(mon->attributeID == UA_ATTRIBUTEID_VALUE) {
24249  const UA_VariableNode *vn = (const UA_VariableNode*)
24250  UA_NodeStore_get(server->nodestore, &mon->monitoredNodeId);
24251  if(vn && vn->nodeClass == UA_NODECLASS_VARIABLE &&
24252  samplingInterval < vn->minimumSamplingInterval)
24253  samplingInterval = vn->minimumSamplingInterval;
24254  } else if(mon->attributeID == UA_ATTRIBUTEID_EVENTNOTIFIER) {
24255  /* TODO: events should not need a samplinginterval */
24256  samplingInterval = 10000.0f; // 10 seconds to reduce the load
24257  }
24258  mon->samplingInterval = samplingInterval;
24259  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.samplingIntervalLimits,
24260  samplingInterval, mon->samplingInterval);
24261  if(samplingInterval != samplingInterval) /* Check for nan */
24262  mon->samplingInterval = server->config.samplingIntervalLimits.min;
24263 
24264  /* Filter */
24265  if(params->filter.encoding != UA_EXTENSIONOBJECT_DECODED ||
24267  /* Default: Trigger only on the value and the statuscode */
24268  mon->trigger = UA_DATACHANGETRIGGER_STATUSVALUE;
24269  } else {
24270  UA_DataChangeFilter *filter = params->filter.content.decoded.data;
24271  mon->trigger = filter->trigger;
24272  }
24273 
24274  /* QueueSize */
24275  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.queueSizeLimits,
24276  params->queueSize, mon->maxQueueSize);
24277 
24278  /* DiscardOldest */
24279  mon->discardOldest = params->discardOldest;
24280 
24281  /* Register sample job if reporting is enabled */
24282  if(monitoringMode == UA_MONITORINGMODE_REPORTING)
24283  MonitoredItem_registerSampleJob(server, mon);
24284 }
24285 
24286 static const UA_String binaryEncoding = {sizeof("Default Binary")-1, (UA_Byte*)"Default Binary"};
24287 /* static const UA_String xmlEncoding = {sizeof("Default Xml")-1, (UA_Byte*)"Default Xml"}; */
24288 
24289 static void
24290 Service_CreateMonitoredItems_single(UA_Server *server, UA_Session *session,
24291  UA_Subscription *sub,
24292  const UA_TimestampsToReturn timestampsToReturn,
24293  const UA_MonitoredItemCreateRequest *request,
24294  UA_MonitoredItemCreateResult *result) {
24295  /* Make an example read to get errors in the itemToMonitor. Allow return
24296  * codes "good" and "uncertain", as well as a list of statuscodes that might
24297  * be repaired inside the data source. */
24298  UA_DataValue v;
24299  UA_DataValue_init(&v);
24300  Service_Read_single(server, session, timestampsToReturn, &request->itemToMonitor, &v);
24301  if(v.hasStatus && (v.status >> 30) > 1 &&
24305  result->statusCode = v.status;
24306  UA_DataValue_deleteMembers(&v);
24307  return;
24308  }
24309  UA_DataValue_deleteMembers(&v);
24310 
24311  /* Check if the encoding is supported */
24312  if(request->itemToMonitor.dataEncoding.name.length > 0 &&
24313  (!UA_String_equal(&binaryEncoding, &request->itemToMonitor.dataEncoding.name) ||
24314  request->itemToMonitor.dataEncoding.namespaceIndex != 0)) {
24316  return;
24317  }
24318 
24319  /* Check if the encoding is set for a value */
24321  request->itemToMonitor.dataEncoding.name.length > 0) {
24323  return;
24324  }
24325 
24326  /* Create the monitoreditem */
24328  if(!newMon) {
24330  return;
24331  }
24332  UA_StatusCode retval = UA_NodeId_copy(&request->itemToMonitor.nodeId,
24333  &newMon->monitoredNodeId);
24334  if(retval != UA_STATUSCODE_GOOD) {
24335  result->statusCode = retval;
24336  MonitoredItem_delete(server, newMon);
24337  return;
24338  }
24339  newMon->subscription = sub;
24340  newMon->attributeID = request->itemToMonitor.attributeId;
24341  newMon->itemId = ++(sub->lastMonitoredItemId);
24342  newMon->timestampsToReturn = timestampsToReturn;
24343  setMonitoredItemSettings(server, newMon, request->monitoringMode,
24344  &request->requestedParameters);
24345  LIST_INSERT_HEAD(&sub->monitoredItems, newMon, listEntry);
24346 
24347  /* Create the first sample */
24349  UA_MoniteredItem_SampleCallback(server, newMon);
24350 
24351  /* Prepare the response */
24352  UA_String_copy(&request->itemToMonitor.indexRange, &newMon->indexRange);
24353  result->revisedSamplingInterval = newMon->samplingInterval;
24354  result->revisedQueueSize = newMon->maxQueueSize;
24355  result->monitoredItemId = newMon->itemId;
24356 }
24357 
24358 void
24359 Service_CreateMonitoredItems(UA_Server *server, UA_Session *session,
24360  const UA_CreateMonitoredItemsRequest *request,
24361  UA_CreateMonitoredItemsResponse *response) {
24362  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24363  "Processing CreateMonitoredItemsRequest");
24364 
24365  /* Check if the timestampstoreturn is valid */
24368  return;
24369  }
24370 
24371  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24372  if(!sub) {
24374  return;
24375  }
24376 
24377  /* Reset the subscription lifetime */
24378  sub->currentLifetimeCount = 0;
24379  if(request->itemsToCreateSize <= 0) {
24381  return;
24382  }
24383 
24384  response->results = UA_Array_new(request->itemsToCreateSize,
24386  if(!response->results) {
24388  return;
24389  }
24390  response->resultsSize = request->itemsToCreateSize;
24391 
24392  for(size_t i = 0; i < request->itemsToCreateSize; ++i)
24393  Service_CreateMonitoredItems_single(server, session, sub, request->timestampsToReturn,
24394  &request->itemsToCreate[i], &response->results[i]);
24395 }
24396 
24397 static void
24398 Service_ModifyMonitoredItems_single(UA_Server *server, UA_Session *session, UA_Subscription *sub,
24399  const UA_MonitoredItemModifyRequest *request,
24400  UA_MonitoredItemModifyResult *result) {
24402  if(!mon) {
24404  return;
24405  }
24406 
24407  setMonitoredItemSettings(server, mon, mon->monitoringMode,
24408  &request->requestedParameters);
24409  result->revisedSamplingInterval = mon->samplingInterval;
24410  result->revisedQueueSize = mon->maxQueueSize;
24411 }
24412 
24413 void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session,
24414  const UA_ModifyMonitoredItemsRequest *request,
24415  UA_ModifyMonitoredItemsResponse *response) {
24416  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24417  "Processing ModifyMonitoredItemsRequest");
24418 
24419  /* check if the timestampstoreturn is valid */
24422  return;
24423  }
24424 
24425  /* Get the subscription */
24426  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24427  if(!sub) {
24429  return;
24430  }
24431 
24432  /* Reset the subscription lifetime */
24433  sub->currentLifetimeCount = 0;
24434  if(request->itemsToModifySize <= 0) {
24436  return;
24437  }
24438 
24439  response->results = UA_Array_new(request->itemsToModifySize,
24441  if(!response->results) {
24443  return;
24444  }
24445  response->resultsSize = request->itemsToModifySize;
24446 
24447  for(size_t i = 0; i < request->itemsToModifySize; ++i)
24448  Service_ModifyMonitoredItems_single(server, session, sub, &request->itemsToModify[i],
24449  &response->results[i]);
24450 
24451 }
24452 
24453 void Service_SetMonitoringMode(UA_Server *server, UA_Session *session,
24454  const UA_SetMonitoringModeRequest *request,
24455  UA_SetMonitoringModeResponse *response) {
24456  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing SetMonitoringMode");
24457  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24458  if(!sub) {
24460  return;
24461  }
24462 
24463  if(request->monitoredItemIdsSize == 0) {
24465  return;
24466  }
24467 
24469  if(!response->results) {
24471  return;
24472  }
24473  response->resultsSize = request->monitoredItemIdsSize;
24474 
24475  for(size_t i = 0; i < response->resultsSize; ++i) {
24476  UA_MonitoredItem *mon =
24478  if(!mon) {
24480  continue;
24481  }
24482  if(request->monitoringMode == mon->monitoringMode)
24483  continue;
24484  mon->monitoringMode = request->monitoringMode;
24485  if(mon->monitoringMode == UA_MONITORINGMODE_REPORTING)
24486  MonitoredItem_registerSampleJob(server, mon);
24487  else
24488  MonitoredItem_unregisterSampleJob(server, mon);
24489  }
24490 }
24491 
24492 
24493 void
24494 Service_Publish(UA_Server *server, UA_Session *session,
24495  const UA_PublishRequest *request, UA_UInt32 requestId) {
24496  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing PublishRequest");
24498  /* Return an error if the session has no subscription */
24499  if(LIST_EMPTY(&session->serverSubscriptions)) {
24501  goto send_error;
24502  }
24503 
24504  UA_PublishResponseEntry *entry = UA_malloc(sizeof(UA_PublishResponseEntry));
24505  if(!entry) {
24507  goto send_error;
24508  }
24509  entry->requestId = requestId;
24510 
24511  /* Build the response */
24512  UA_PublishResponse *response = &entry->response;
24513  UA_PublishResponse_init(response);
24515  if(request->subscriptionAcknowledgementsSize > 0) {
24518  if(!response->results) {
24519  UA_free(entry);
24521  goto send_error;
24522  }
24523  response->resultsSize = request->subscriptionAcknowledgementsSize;
24524  }
24525 
24526  /* Delete Acknowledged Subscription Messages */
24527  for(size_t i = 0; i < request->subscriptionAcknowledgementsSize; ++i) {
24529  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, ack->subscriptionId);
24530  if(!sub) {
24532  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24533  "Cannot process acknowledgements subscription %u",
24534  ack->subscriptionId);
24535  continue;
24536  }
24537  /* Remove the acked transmission from the retransmission queue */
24539  }
24540 
24541  /* Queue the publish response */
24542  SIMPLEQ_INSERT_TAIL(&session->responseQueue, entry, listEntry);
24543  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Queued a publication message",
24545 
24546  /* Answer immediately to a late subscription */
24547  UA_Subscription *immediate;
24548  LIST_FOREACH(immediate, &session->serverSubscriptions, listEntry) {
24549  if(immediate->state == UA_SUBSCRIPTIONSTATE_LATE) {
24550  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Subscription %u | "
24551  "Response on a late subscription", immediate->subscriptionID,
24553  UA_Subscription_publishCallback(server, immediate);
24554  break;
24555  }
24556  }
24557  return;
24558 
24559  UA_PublishResponse err_response;
24560  send_error:
24561  UA_PublishResponse_init(&err_response);
24562  err_response.responseHeader.requestHandle = request->requestHeader.requestHandle;
24563  err_response.responseHeader.timestamp = UA_DateTime_now();
24564  err_response.responseHeader.serviceResult = retval;
24565  UA_assert(err_response.responseHeader.requestHandle != 0);
24566  UA_SecureChannel_sendBinaryMessage(session->channel, requestId, &err_response,
24568 }
24569 
24570 void
24571 Service_DeleteSubscriptions(UA_Server *server, UA_Session *session,
24572  const UA_DeleteSubscriptionsRequest *request,
24573  UA_DeleteSubscriptionsResponse *response) {
24574  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24575  "Processing DeleteSubscriptionsRequest");
24576 
24577  if(request->subscriptionIdsSize == 0) {
24579  return;
24580  }
24581 
24582  response->results = UA_malloc(sizeof(UA_StatusCode) * request->subscriptionIdsSize);
24583  if(!response->results) {
24585  return;
24586  }
24587  response->resultsSize = request->subscriptionIdsSize;
24588 
24589  for(size_t i = 0; i < request->subscriptionIdsSize; ++i) {
24590  response->results[i] = UA_Session_deleteSubscription(server, session, request->subscriptionIds[i]);
24591  if(response->results[i] == UA_STATUSCODE_GOOD) {
24592  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Subscription %u | "
24593  "Subscription deleted", request->subscriptionIds[i]);
24594  } else {
24595  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Deleting Subscription with Id "
24596  "%u failed with error code 0x%08x", request->subscriptionIds[i],
24597  response->results[i]);
24598  }
24599  }
24600 
24601  /* Send dangling publish responses in a delayed job if the last subscription
24602  was removed */
24603  if(LIST_FIRST(&session->serverSubscriptions))
24604  return;
24605  UA_NodeId *sessionToken = UA_NodeId_new();
24606  if(!sessionToken)
24607  return;
24608  UA_NodeId_copy(&session->authenticationToken, sessionToken);
24609  UA_Server_delayedCallback(server, (UA_ServerCallback)UA_Subscription_answerPublishRequestsNoSubscription,
24610  sessionToken);
24611 }
24612 
24613 void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session,
24614  const UA_DeleteMonitoredItemsRequest *request,
24615  UA_DeleteMonitoredItemsResponse *response) {
24616  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24617  "Processing DeleteMonitoredItemsRequest");
24618 
24619  if(request->monitoredItemIdsSize == 0) {
24621  return;
24622  }
24623 
24624  /* Get the subscription */
24625  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24626  if(!sub) {
24628  return;
24629  }
24630 
24631  /* Reset the subscription lifetime */
24632  sub->currentLifetimeCount = 0;
24633  response->results = UA_malloc(sizeof(UA_StatusCode) * request->monitoredItemIdsSize);
24634  if(!response->results) {
24636  return;
24637  }
24638  response->resultsSize = request->monitoredItemIdsSize;
24639 
24640  for(size_t i = 0; i < request->monitoredItemIdsSize; ++i)
24641  response->results[i] = UA_Subscription_deleteMonitoredItem(server, sub, request->monitoredItemIds[i]);
24642 }
24643 
24644 void Service_Republish(UA_Server *server, UA_Session *session, const UA_RepublishRequest *request,
24645  UA_RepublishResponse *response) {
24646  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing RepublishRequest");
24647  /* get the subscription */
24648  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24649  if (!sub) {
24651  return;
24652  }
24653 
24654  /* Reset the subscription lifetime */
24655  sub->currentLifetimeCount = 0;
24656 
24657  /* Find the notification in the retransmission queue */
24659  TAILQ_FOREACH(entry, &sub->retransmissionQueue, listEntry) {
24660  if(entry->message.sequenceNumber == request->retransmitSequenceNumber)
24661  break;
24662  }
24663  if(entry)
24664  response->responseHeader.serviceResult =
24665  UA_NotificationMessage_copy(&entry->message, &response->notificationMessage);
24666  else
24668 }
24669 
24670 #endif /* UA_ENABLE_SUBSCRIPTIONS */
24671 
24672 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/client/ua_client.c" ***********************************/
24673 
24674 /* This Source Code Form is subject to the terms of the Mozilla Public
24675  * License, v. 2.0. If a copy of the MPL was not distributed with this
24676  * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
24677 
24678 
24679 /*********************/
24680 /* Create and Delete */
24681 /*********************/
24682 
24683 static void UA_Client_init(UA_Client* client, UA_ClientConfig config) {
24684  memset(client, 0, sizeof(UA_Client));
24685  client->channel.connection = &client->connection;
24686  client->config = config;
24687 }
24688 
24689 UA_Client * UA_Client_new(UA_ClientConfig config) {
24690  UA_Client *client = (UA_Client*)UA_calloc(1, sizeof(UA_Client));
24691  if(!client)
24692  return NULL;
24693  UA_Client_init(client, config);
24694  return client;
24695 }
24696 
24697 static void UA_Client_deleteMembers(UA_Client* client) {
24698  UA_Client_disconnect(client);
24701  if(client->endpointUrl.data)
24702  UA_String_deleteMembers(&client->endpointUrl);
24703  UA_UserTokenPolicy_deleteMembers(&client->token);
24704  UA_NodeId_deleteMembers(&client->authenticationToken);
24705  if(client->username.data)
24706  UA_String_deleteMembers(&client->username);
24707  if(client->password.data)
24708  UA_String_deleteMembers(&client->password);
24709 #ifdef UA_ENABLE_SUBSCRIPTIONS
24710  UA_Client_NotificationsAckNumber *n, *tmp;
24711  LIST_FOREACH_SAFE(n, &client->pendingNotificationsAcks, listEntry, tmp) {
24712  LIST_REMOVE(n, listEntry);
24713  UA_free(n);
24714  }
24715  UA_Client_Subscription *sub, *tmps;
24716  LIST_FOREACH_SAFE(sub, &client->subscriptions, listEntry, tmps)
24717  UA_Client_Subscriptions_forceDelete(client, sub); /* force local removal */
24718 #endif
24719 }
24720 
24722  UA_Client_deleteMembers(client);
24723  UA_Client_init(client, client->config);
24724 }
24725 
24727  UA_Client_deleteMembers(client);
24728  UA_free(client);
24729 }
24730 
24731 UA_ClientState UA_Client_getState(UA_Client *client) {
24732  if(!client)
24733  return UA_CLIENTSTATE_ERRORED;
24734  return client->state;
24735 }
24736 
24737 /*************************/
24738 /* Manage the Connection */
24739 /*************************/
24740 
24741 #define UA_MINMESSAGESIZE 8192
24742 
24743 static UA_StatusCode
24744 HelAckHandshake(UA_Client *client) {
24745  /* Get a buffer */
24746  UA_ByteString message;
24747  UA_Connection *conn = &client->connection;
24748  UA_StatusCode retval = conn->getSendBuffer(conn, UA_MINMESSAGESIZE, &message);
24749  if(retval != UA_STATUSCODE_GOOD)
24750  return retval;
24751 
24752  /* Prepare the HEL message and encode at offset 8 */
24753  UA_TcpHelloMessage hello;
24754  UA_String_copy(&client->endpointUrl, &hello.endpointUrl); /* must be less than 4096 bytes */
24755  hello.maxChunkCount = conn->localConf.maxChunkCount;
24756  hello.maxMessageSize = conn->localConf.maxMessageSize;
24759  hello.sendBufferSize = conn->localConf.sendBufferSize;
24760 
24761  size_t offset = 8;
24762  retval = UA_TcpHelloMessage_encodeBinary(&hello, &message, &offset);
24763  UA_TcpHelloMessage_deleteMembers(&hello);
24764 
24765  /* Encode the message header at offset 0 */
24766  UA_TcpMessageHeader messageHeader;
24768  messageHeader.messageSize = (UA_UInt32)offset;
24769  offset = 0;
24770  retval |= UA_TcpMessageHeader_encodeBinary(&messageHeader, &message, &offset);
24771  if(retval != UA_STATUSCODE_GOOD) {
24772  conn->releaseSendBuffer(conn, &message);
24773  return retval;
24774  }
24775 
24776  /* Send the HEL message */
24777  message.length = messageHeader.messageSize;
24778  retval = conn->send(conn, &message);
24779  if(retval != UA_STATUSCODE_GOOD) {
24780  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK,
24781  "Sending HEL failed");
24782  return retval;
24783  }
24784  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_NETWORK,
24785  "Sent HEL message");
24786 
24787  /* Loop until we have a complete chunk */
24789  UA_Boolean realloced = false;
24790  retval = UA_Connection_receiveChunksBlocking(conn, &reply, &realloced,
24791  client->config.timeout);
24792  if(retval != UA_STATUSCODE_GOOD) {
24793  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK,
24794  "Receiving ACK message failed");
24795  return retval;
24796  }
24797 
24798  /* Decode the message */
24799  offset = 0;
24800  UA_TcpAcknowledgeMessage ackMessage;
24801  retval = UA_TcpMessageHeader_decodeBinary(&reply, &offset, &messageHeader);
24802  retval |= UA_TcpAcknowledgeMessage_decodeBinary(&reply, &offset, &ackMessage);
24803 
24804  /* Free the message buffer */
24805  if(!realloced)
24806  conn->releaseRecvBuffer(conn, &reply);
24807  else
24808  UA_ByteString_deleteMembers(&reply);
24809 
24810  /* Store remote connection settings and adjust local configuration to not
24811  exceed the limits */
24812  if(retval == UA_STATUSCODE_GOOD) {
24813  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_NETWORK, "Received ACK message");
24814  conn->remoteConf.maxChunkCount = ackMessage.maxChunkCount; /* may be zero -> unlimited */
24815  conn->remoteConf.maxMessageSize = ackMessage.maxMessageSize; /* may be zero -> unlimited */
24816  conn->remoteConf.protocolVersion = ackMessage.protocolVersion;
24817  conn->remoteConf.sendBufferSize = ackMessage.sendBufferSize;
24818  conn->remoteConf.recvBufferSize = ackMessage.receiveBufferSize;
24824  } else {
24825  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK, "Decoding ACK message failed");
24826  }
24827  UA_TcpAcknowledgeMessage_deleteMembers(&ackMessage);
24828 
24829  return retval;
24830 }
24831 
24832 static UA_StatusCode
24833 SecureChannelHandshake(UA_Client *client, UA_Boolean renew) {
24834  /* Check if sc is still valid */
24835  if(renew && client->nextChannelRenewal - UA_DateTime_nowMonotonic() > 0)
24836  return UA_STATUSCODE_GOOD;
24837 
24838  UA_Connection *conn = &client->connection;
24839  if(conn->state != UA_CONNECTION_ESTABLISHED)
24841 
24842  UA_ByteString message;
24843  UA_StatusCode retval = conn->getSendBuffer(conn, conn->remoteConf.recvBufferSize, &message);
24844  if(retval != UA_STATUSCODE_GOOD)
24845  return retval;
24846 
24847  /* Jump over the messageHeader that will be encoded last */
24848  size_t offset = 12;
24849 
24850  /* Encode the Asymmetric Security Header */
24852  UA_AsymmetricAlgorithmSecurityHeader_init(&asymHeader);
24853  asymHeader.securityPolicyUri = UA_STRING("http://opcfoundation.org/UA/SecurityPolicy#None");
24854  retval = UA_AsymmetricAlgorithmSecurityHeader_encodeBinary(&asymHeader, &message, &offset);
24855 
24856  /* Encode the sequence header */
24857  UA_SequenceHeader seqHeader;
24858  seqHeader.sequenceNumber = ++client->channel.sendSequenceNumber;
24859  seqHeader.requestId = ++client->requestId;
24860  retval |= UA_SequenceHeader_encodeBinary(&seqHeader, &message, &offset);
24861 
24862  /* Encode the NodeId of the OpenSecureChannel Service */
24863  UA_NodeId requestType =
24864  UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST].binaryEncodingId);
24865  retval |= UA_NodeId_encodeBinary(&requestType, &message, &offset);
24866 
24867  /* Encode the OpenSecureChannelRequest */
24868  UA_OpenSecureChannelRequest opnSecRq;
24869  UA_OpenSecureChannelRequest_init(&opnSecRq);
24872  if(renew) {
24874  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24875  "Requesting to renew the SecureChannel");
24876  } else {
24878  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24879  "Requesting to open a SecureChannel");
24880  }
24882  opnSecRq.clientNonce = client->channel.clientNonce;
24883  opnSecRq.requestedLifetime = client->config.secureChannelLifeTime;
24884  retval |= UA_OpenSecureChannelRequest_encodeBinary(&opnSecRq, &message, &offset);
24885 
24886  /* Encode the message header at the beginning */
24887  UA_SecureConversationMessageHeader messageHeader;
24889  messageHeader.messageHeader.messageSize = (UA_UInt32)offset;
24890  if(renew)
24891  messageHeader.secureChannelId = client->channel.securityToken.channelId;
24892  else
24893  messageHeader.secureChannelId = 0;
24894  offset = 0;
24895  retval |= UA_SecureConversationMessageHeader_encodeBinary(&messageHeader, &message, &offset);
24896 
24897  /* Clean up and return if encoding the message failed */
24898  if(retval != UA_STATUSCODE_GOOD) {
24899  client->connection.releaseSendBuffer(&client->connection, &message);
24900  return retval;
24901  }
24902 
24903  /* Send the message */
24904  message.length = messageHeader.messageHeader.messageSize;
24905  retval = conn->send(conn, &message);
24906  if(retval != UA_STATUSCODE_GOOD)
24907  return retval;
24908 
24909  /* Receive the response */
24911  UA_Boolean realloced = false;
24912  retval = UA_Connection_receiveChunksBlocking(conn, &reply, &realloced,
24913  client->config.timeout);
24914  if(retval != UA_STATUSCODE_GOOD) {
24915  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24916  "Receiving OpenSecureChannelResponse failed");
24917  return retval;
24918  }
24919 
24920  /* Decode the header */
24921  offset = 0;
24922  retval = UA_SecureConversationMessageHeader_decodeBinary(&reply, &offset, &messageHeader);
24923  retval |= UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(&reply, &offset, &asymHeader);
24924  retval |= UA_SequenceHeader_decodeBinary(&reply, &offset, &seqHeader);
24925  retval |= UA_NodeId_decodeBinary(&reply, &offset, &requestType);
24926  UA_NodeId expectedRequest =
24927  UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE].binaryEncodingId);
24928  if(retval != UA_STATUSCODE_GOOD || !UA_NodeId_equal(&requestType, &expectedRequest)) {
24929  UA_ByteString_deleteMembers(&reply);
24930  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
24931  UA_NodeId_deleteMembers(&requestType);
24932  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
24933  "Reply answers the wrong request. Expected OpenSecureChannelResponse.");
24935  }
24936 
24937  /* Save the sequence number from server */
24938  client->channel.receiveSequenceNumber = seqHeader.sequenceNumber;
24939 
24940  /* Decode the response */
24942  retval = UA_OpenSecureChannelResponse_decodeBinary(&reply, &offset, &response);
24943 
24944  /* Free the message */
24945  if(!realloced)
24946  conn->releaseRecvBuffer(conn, &reply);
24947  else
24948  UA_ByteString_deleteMembers(&reply);
24949 
24950  /* Results in either the StatusCode of decoding or the service */
24951  retval |= response.responseHeader.serviceResult;
24952 
24953  if(retval == UA_STATUSCODE_GOOD) {
24954  /* Response.securityToken.revisedLifetime is UInt32 we need to cast it
24955  * to DateTime=Int64 we take 75% of lifetime to start renewing as
24956  * described in standard */
24959 
24960  /* Replace the old nonce */
24961  UA_ChannelSecurityToken_deleteMembers(&client->channel.securityToken);
24962  UA_ChannelSecurityToken_copy(&response.securityToken, &client->channel.securityToken);
24963  UA_ByteString_deleteMembers(&client->channel.serverNonce);
24964  UA_ByteString_copy(&response.serverNonce, &client->channel.serverNonce);
24965 
24966  if(renew)
24967  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24968  "SecureChannel renewed");
24969  else
24970  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24971  "SecureChannel opened");
24972  } else {
24973  if(renew)
24974  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24975  "SecureChannel could not be renewed "
24976  "with error code %s", UA_StatusCode_name(retval));
24977  else
24978  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24979  "SecureChannel could not be opened "
24980  "with error code %s", UA_StatusCode_name(retval));
24981  }
24982 
24983  /* Clean up */
24984  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
24985  UA_OpenSecureChannelResponse_deleteMembers(&response);
24986  return retval;
24987 }
24988 
24989 static UA_StatusCode
24990 ActivateSession(UA_Client *client) {
24991  UA_ActivateSessionRequest request;
24992  UA_ActivateSessionRequest_init(&request);
24993  request.requestHeader.requestHandle = ++client->requestHandle;
24995  request.requestHeader.timeoutHint = 600000;
24996 
24997  //manual ExtensionObject encoding of the identityToken
24999  UA_AnonymousIdentityToken* identityToken = UA_AnonymousIdentityToken_new();
25000  UA_AnonymousIdentityToken_init(identityToken);
25001  UA_String_copy(&client->token.policyId, &identityToken->policyId);
25004  request.userIdentityToken.content.decoded.data = identityToken;
25005  } else {
25006  UA_UserNameIdentityToken* identityToken = UA_UserNameIdentityToken_new();
25007  UA_UserNameIdentityToken_init(identityToken);
25008  UA_String_copy(&client->token.policyId, &identityToken->policyId);
25009  UA_String_copy(&client->username, &identityToken->userName);
25010  UA_String_copy(&client->password, &identityToken->password);
25013  request.userIdentityToken.content.decoded.data = identityToken;
25014  }
25015 
25016  UA_ActivateSessionResponse response;
25019 
25020  if(response.responseHeader.serviceResult) {
25021  UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT,
25022  "ActivateSession failed with error code %s",
25023  UA_StatusCode_name(response.responseHeader.serviceResult));
25024  }
25025 
25026  UA_StatusCode retval = response.responseHeader.serviceResult;
25027  UA_ActivateSessionRequest_deleteMembers(&request);
25028  UA_ActivateSessionResponse_deleteMembers(&response);
25029  return retval;
25030 }
25031 
25032 /* Gets a list of endpoints. Memory is allocated for endpointDescription array */
25033 static UA_StatusCode
25034 GetEndpoints(UA_Client *client, size_t* endpointDescriptionsSize,
25035  UA_EndpointDescription** endpointDescriptions) {
25036  UA_GetEndpointsRequest request;
25037  UA_GetEndpointsRequest_init(&request);
25039  request.requestHeader.timeoutHint = 10000;
25040  // assume the endpointurl outlives the service call
25041  request.endpointUrl = client->endpointUrl;
25042 
25043  UA_GetEndpointsResponse response;
25044  UA_GetEndpointsResponse_init(&response);
25047 
25049  UA_StatusCode retval = response.responseHeader.serviceResult;
25050  UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT,
25051  "GetEndpointRequest failed with error code %s",
25052  UA_StatusCode_name(retval));
25053  UA_GetEndpointsResponse_deleteMembers(&response);
25054  return retval;
25055  }
25056  *endpointDescriptions = response.endpoints;
25057  *endpointDescriptionsSize = response.endpointsSize;
25058  response.endpoints = NULL;
25059  response.endpointsSize = 0;
25060  UA_GetEndpointsResponse_deleteMembers(&response);
25061  return UA_STATUSCODE_GOOD;
25062 }
25063 
25064 static UA_StatusCode
25065 EndpointsHandshake(UA_Client *client) {
25066  UA_EndpointDescription* endpointArray = NULL;
25067  size_t endpointArraySize = 0;
25068  UA_StatusCode retval = GetEndpoints(client, &endpointArraySize, &endpointArray);
25069  if(retval != UA_STATUSCODE_GOOD)
25070  return retval;
25071 
25072  UA_Boolean endpointFound = false;
25073  UA_Boolean tokenFound = false;
25074  UA_String securityNone = UA_STRING("http://opcfoundation.org/UA/SecurityPolicy#None");
25075  UA_String binaryTransport = UA_STRING("http://opcfoundation.org/UA-Profile/"
25076  "Transport/uatcp-uasc-uabinary");
25077 
25078  //TODO: compare endpoint information with client->endpointUri
25079  for(size_t i = 0; i < endpointArraySize; ++i) {
25080  UA_EndpointDescription* endpoint = &endpointArray[i];
25081  /* look out for binary transport endpoints */
25082  /* Note: Siemens returns empty ProfileUrl, we will accept it as binary */
25083  if(endpoint->transportProfileUri.length != 0 &&
25084  !UA_String_equal(&endpoint->transportProfileUri, &binaryTransport))
25085  continue;
25086  /* look out for an endpoint without security */
25087  if(!UA_String_equal(&endpoint->securityPolicyUri, &securityNone))
25088  continue;
25089 
25090  /* endpoint with no security found */
25091  endpointFound = true;
25092 
25093  /* look for a user token policy with an anonymous token */
25094  for(size_t j = 0; j < endpoint->userIdentityTokensSize; ++j) {
25095  UA_UserTokenPolicy* userToken = &endpoint->userIdentityTokens[j];
25096 
25097  /* Usertokens also have a security policy... */
25098  if(userToken->securityPolicyUri.length > 0 &&
25099  !UA_String_equal(&userToken->securityPolicyUri, &securityNone))
25100  continue;
25101 
25102  /* UA_CLIENTAUTHENTICATION_NONE == UA_USERTOKENTYPE_ANONYMOUS
25103  * UA_CLIENTAUTHENTICATION_USERNAME == UA_USERTOKENTYPE_USERNAME
25104  * TODO: Check equivalence for other types when adding the support */
25105  if((int)client->authenticationMethod != (int)userToken->tokenType)
25106  continue;
25107 
25108  /* Endpoint with matching usertokenpolicy found */
25109  tokenFound = true;
25110  UA_UserTokenPolicy_copy(userToken, &client->token);
25111  break;
25112  }
25113  }
25114 
25115  UA_Array_delete(endpointArray, endpointArraySize,
25117 
25118  if(!endpointFound) {
25119  UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT,
25120  "No suitable endpoint found");
25122  } else if(!tokenFound) {
25123  UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT,
25124  "No suitable UserTokenPolicy found for the possible endpoints");
25126  }
25127  return retval;
25128 }
25129 
25130 static UA_StatusCode
25131 SessionHandshake(UA_Client *client) {
25132  UA_CreateSessionRequest request;
25133  UA_CreateSessionRequest_init(&request);
25134 
25136  request.requestHeader.timeoutHint = 10000;
25137  UA_ByteString_copy(&client->channel.clientNonce, &request.clientNonce);
25138  request.requestedSessionTimeout = 1200000;
25140  UA_String_copy(&client->endpointUrl, &request.endpointUrl);
25141 
25142  UA_CreateSessionResponse response;
25143  UA_CreateSessionResponse_init(&response);
25146 
25147  UA_NodeId_copy(&response.authenticationToken, &client->authenticationToken);
25148 
25149  UA_StatusCode retval = response.responseHeader.serviceResult;
25150  UA_CreateSessionRequest_deleteMembers(&request);
25151  UA_CreateSessionResponse_deleteMembers(&response);
25152  return retval;
25153 }
25154 
25155 static UA_StatusCode
25156 CloseSession(UA_Client *client) {
25157  UA_CloseSessionRequest request;
25158  UA_CloseSessionRequest_init(&request);
25159 
25161  request.requestHeader.timeoutHint = 10000;
25162  request.deleteSubscriptions = true;
25163  UA_CloseSessionResponse response;
25166 
25167  UA_StatusCode retval = response.responseHeader.serviceResult;
25168  UA_CloseSessionRequest_deleteMembers(&request);
25169  UA_CloseSessionResponse_deleteMembers(&response);
25170  return retval;
25171 }
25172 
25173 static UA_StatusCode
25174 CloseSecureChannel(UA_Client *client) {
25175  UA_SecureChannel *channel = &client->channel;
25177  UA_CloseSecureChannelRequest_init(&request);
25178  request.requestHeader.requestHandle = ++client->requestHandle;
25180  request.requestHeader.timeoutHint = 10000;
25181  UA_NodeId_copy(&client->authenticationToken,
25183 
25186  msgHeader.secureChannelId = channel->securityToken.channelId;
25187 
25189  symHeader.tokenId = channel->securityToken.tokenId;
25190 
25191  UA_SequenceHeader seqHeader;
25192  seqHeader.sequenceNumber = ++channel->sendSequenceNumber;
25193  seqHeader.requestId = ++client->requestId;
25194 
25195  UA_NodeId typeId =
25196  UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_CLOSESECURECHANNELREQUEST].binaryEncodingId);
25197 
25198  UA_ByteString message;
25199  UA_Connection *conn = &client->connection;
25200  UA_StatusCode retval = conn->getSendBuffer(conn, conn->remoteConf.recvBufferSize, &message);
25201  if(retval != UA_STATUSCODE_GOOD){
25202  UA_CloseSecureChannelRequest_deleteMembers(&request);
25203  return retval;
25204  }
25205 
25206  size_t offset = 12;
25207  retval |= UA_SymmetricAlgorithmSecurityHeader_encodeBinary(&symHeader, &message, &offset);
25208  retval |= UA_SequenceHeader_encodeBinary(&seqHeader, &message, &offset);
25209  retval |= UA_NodeId_encodeBinary(&typeId, &message, &offset);
25211  NULL, NULL, &message, &offset);
25212 
25213  msgHeader.messageHeader.messageSize = (UA_UInt32)offset;
25214  offset = 0;
25215  retval |= UA_SecureConversationMessageHeader_encodeBinary(&msgHeader, &message, &offset);
25216 
25217  if(retval == UA_STATUSCODE_GOOD) {
25218  message.length = msgHeader.messageHeader.messageSize;
25219  retval = conn->send(conn, &message);
25220  } else {
25221  conn->releaseSendBuffer(conn, &message);
25222  }
25223  conn->close(conn);
25224  UA_CloseSecureChannelRequest_deleteMembers(&request);
25225  return retval;
25226 }
25227 
25229 UA_Client_getEndpoints(UA_Client *client, const char *serverUrl,
25230  size_t* endpointDescriptionsSize,
25231  UA_EndpointDescription** endpointDescriptions) {
25232  if(client->state == UA_CLIENTSTATE_CONNECTED)
25233  return UA_STATUSCODE_GOOD;
25234  if(client->state == UA_CLIENTSTATE_ERRORED)
25235  UA_Client_reset(client);
25236 
25237 
25239  client->connection =
25240  client->config.connectionFunc(UA_ConnectionConfig_standard, serverUrl,
25241  client->config.logger);
25242  if(client->connection.state != UA_CONNECTION_OPENING) {
25244  goto cleanup;
25245  }
25246 
25247  client->endpointUrl = UA_STRING_ALLOC(serverUrl);
25248  if(!client->endpointUrl.data) {
25250  goto cleanup;
25251  }
25252 
25253  client->connection.localConf = client->config.localConnectionConfig;
25254  retval = HelAckHandshake(client);
25255  if(retval == UA_STATUSCODE_GOOD)
25256  retval = SecureChannelHandshake(client, false);
25257  if(retval == UA_STATUSCODE_GOOD)
25258  retval = GetEndpoints(client, endpointDescriptionsSize, endpointDescriptions);
25259 
25260  /* always cleanup */
25261  cleanup:
25262  UA_Client_disconnect(client);
25263  UA_Client_reset(client);
25264  return retval;
25265 }
25266 
25268 UA_Client_connect_username(UA_Client *client, const char *endpointUrl,
25269  const char *username, const char *password){
25271  client->username = UA_STRING_ALLOC(username);
25272  client->password = UA_STRING_ALLOC(password);
25273  return UA_Client_connect(client, endpointUrl);
25274 }
25275 
25276 
25278 UA_Client_connect(UA_Client *client, const char *endpointUrl) {
25279  if(client->state == UA_CLIENTSTATE_CONNECTED)
25280  return UA_STATUSCODE_GOOD;
25281  if(client->state == UA_CLIENTSTATE_ERRORED) {
25282  UA_Client_reset(client);
25283  }
25284 
25286  client->connection =
25287  client->config.connectionFunc(UA_ConnectionConfig_standard,
25288  endpointUrl, client->config.logger);
25289  if(client->connection.state != UA_CONNECTION_OPENING) {
25291  goto cleanup;
25292  }
25293 
25294  client->endpointUrl = UA_STRING_ALLOC(endpointUrl);
25295  if(!client->endpointUrl.data) {
25297  goto cleanup;
25298  }
25299 
25300  client->connection.localConf = client->config.localConnectionConfig;
25301  retval = HelAckHandshake(client);
25302  if(retval == UA_STATUSCODE_GOOD)
25303  retval = SecureChannelHandshake(client, false);
25304  if(retval == UA_STATUSCODE_GOOD)
25305  retval = EndpointsHandshake(client);
25306  if(retval == UA_STATUSCODE_GOOD)
25307  retval = SessionHandshake(client);
25308  if(retval == UA_STATUSCODE_GOOD)
25309  retval = ActivateSession(client);
25310  if(retval == UA_STATUSCODE_GOOD) {
25312  client->state = UA_CLIENTSTATE_CONNECTED;
25313  } else {
25314  goto cleanup;
25315  }
25316  return retval;
25317 
25318  cleanup:
25319  UA_Client_reset(client);
25320  return retval;
25321 }
25322 
25324  if(client->state == UA_CLIENTSTATE_READY)
25327  /* Is a session established? */
25328  if(client->connection.state == UA_CONNECTION_ESTABLISHED &&
25329  !UA_NodeId_equal(&client->authenticationToken, &UA_NODEID_NULL))
25330  retval = CloseSession(client);
25331  /* Is a secure channel established? */
25333  retval |= CloseSecureChannel(client);
25334  return retval;
25335 }
25336 
25338  UA_StatusCode retval = SecureChannelHandshake(client, true);
25339  if(retval == UA_STATUSCODE_GOOD)
25340  client->state = UA_CLIENTSTATE_CONNECTED;
25341  return retval;
25342 }
25343 
25344 /****************/
25345 /* Raw Services */
25346 /****************/
25347 
25352  void *response;
25354 };
25355 
25356 static void
25357 processServiceResponse(struct ResponseDescription *rd, UA_SecureChannel *channel,
25358  UA_MessageType messageType, UA_UInt32 requestId,
25359  UA_ByteString *message) {
25361  const UA_NodeId expectedNodeId =
25362  UA_NODEID_NUMERIC(0, rd->responseType->binaryEncodingId);
25363  const UA_NodeId serviceFaultNodeId =
25364  UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_SERVICEFAULT].binaryEncodingId);
25365 
25366  UA_ResponseHeader *respHeader = (UA_ResponseHeader*)rd->response;
25367  rd->processed = true;
25368 
25369  if(messageType == UA_MESSAGETYPE_ERR) {
25370  UA_TcpErrorMessage *msg = (UA_TcpErrorMessage*)message;
25371  UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25372  "Server replied with an error message: %s %.*s",
25373  UA_StatusCode_name(msg->error), msg->reason.length, msg->reason.data);
25374  retval = msg->error;
25375  goto finish;
25376  } else if(messageType != UA_MESSAGETYPE_MSG) {
25377  UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25378  "Server replied with the wrong message type");
25380  goto finish;
25381  }
25382 
25383  /* Check that the request id matches */
25384  /* Todo: we need to demux async responses since a publish responses may come
25385  at any time */
25386  if(requestId != rd->requestId) {
25387  UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25388  "Reply answers the wrong requestId. "
25389  "Async services are not yet implemented.");
25391  goto finish;
25392  }
25393 
25394  /* Check that the response type matches */
25395  size_t offset = 0;
25396  UA_NodeId responseId;
25397  retval = UA_NodeId_decodeBinary(message, &offset, &responseId);
25398  if(retval != UA_STATUSCODE_GOOD)
25399  goto finish;
25400  if(!UA_NodeId_equal(&responseId, &expectedNodeId)) {
25401  if(UA_NodeId_equal(&responseId, &serviceFaultNodeId)) {
25402  /* Take the statuscode from the servicefault */
25403  retval = UA_decodeBinary(message, &offset, rd->response,
25405  } else {
25406  UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25407  "Reply answers the wrong request. Expected ns=%i,i=%i."
25408  "But retrieved ns=%i,i=%i", expectedNodeId.namespaceIndex,
25409  expectedNodeId.identifier.numeric, responseId.namespaceIndex,
25410  responseId.identifier.numeric);
25411  UA_NodeId_deleteMembers(&responseId);
25413  }
25414  goto finish;
25415  }
25416 
25417  /* Decode the response */
25418  retval = UA_decodeBinary(message, &offset, rd->response, rd->responseType);
25419 
25420  finish:
25421  if(retval == UA_STATUSCODE_GOOD) {
25422  UA_LOG_DEBUG(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25423  "Received a response of type %i", responseId.identifier.numeric);
25424  } else {
25427  UA_LOG_INFO(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25428  "Error receiving the response");
25429  respHeader->serviceResult = retval;
25430  }
25431 }
25432 
25433 void
25434 __UA_Client_Service(UA_Client *client, const void *request, const UA_DataType *requestType,
25435  void *response, const UA_DataType *responseType) {
25436  UA_init(response, responseType);
25437  UA_ResponseHeader *respHeader = (UA_ResponseHeader*)response;
25438 
25439  /* Make sure we have a valid session */
25441  if(retval != UA_STATUSCODE_GOOD) {
25442  respHeader->serviceResult = retval;
25443  client->state = UA_CLIENTSTATE_ERRORED;
25444  return;
25445  }
25446 
25447  /* Adjusting the request header. The const attribute is violated, but we
25448  * only touch the following members: */
25449  UA_RequestHeader *rr = (UA_RequestHeader*)(uintptr_t)request;
25450  rr->authenticationToken = client->authenticationToken; /* cleaned up at the end */
25451  rr->timestamp = UA_DateTime_now();
25452  rr->requestHandle = ++client->requestHandle;
25453 
25454  /* Send the request */
25455  UA_UInt32 requestId = ++client->requestId;
25456  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
25457  "Sending a request of type %i", requestType->typeId.identifier.numeric);
25458  retval = UA_SecureChannel_sendBinaryMessage(&client->channel, requestId, rr, requestType);
25459  if(retval != UA_STATUSCODE_GOOD) {
25462  else
25463  respHeader->serviceResult = retval;
25464  client->state = UA_CLIENTSTATE_FAULTED;
25465  UA_NodeId_init(&rr->authenticationToken);
25466  return;
25467  }
25468 
25469  /* Prepare the response and the structure we give into processServiceResponse */
25470  UA_init(response, responseType);
25471  struct ResponseDescription rd = {client, false, requestId, response, responseType};
25472 
25473  /* Retrieve the response */
25474  UA_DateTime maxDate = UA_DateTime_nowMonotonic() + (client->config.timeout * UA_MSEC_TO_DATETIME);
25475  do {
25476  /* Retrieve complete chunks */
25478  UA_Boolean realloced = false;
25480  if(now < maxDate) {
25481  UA_UInt32 timeout = (UA_UInt32)((maxDate - now) / UA_MSEC_TO_DATETIME);
25482  retval = UA_Connection_receiveChunksBlocking(&client->connection, &reply, &realloced, timeout);
25483  } else {
25485  }
25486  if(retval != UA_STATUSCODE_GOOD) {
25487  respHeader->serviceResult = retval;
25488  break;
25489  }
25490  /* ProcessChunks and call processServiceResponse for complete messages */
25491  UA_SecureChannel_processChunks(&client->channel, &reply,
25492  (UA_ProcessMessageCallback*)processServiceResponse, &rd);
25493  /* Free the received buffer */
25494  if(!realloced)
25495  client->connection.releaseRecvBuffer(&client->connection, &reply);
25496  else
25497  UA_ByteString_deleteMembers(&reply);
25498  } while(!rd.processed);
25499 
25500  /* Clean up the authentication token */
25501  UA_NodeId_init(&rr->authenticationToken);
25502 }
25503 
25504 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/client/ua_client_highlevel.c" ***********************************/
25505 
25506 /* This Source Code Form is subject to the terms of the Mozilla Public
25507 * License, v. 2.0. If a copy of the MPL was not distributed with this
25508 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
25509 
25510 
25513  UA_UInt16 *namespaceIndex) {
25514  UA_ReadRequest request;
25515  UA_ReadRequest_init(&request);
25516  UA_ReadValueId id;
25517  UA_ReadValueId_init(&id);
25518  id.attributeId = UA_ATTRIBUTEID_VALUE;
25519  id.nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_NAMESPACEARRAY);
25520  request.nodesToRead = &id;
25521  request.nodesToReadSize = 1;
25522 
25523  UA_ReadResponse response = UA_Client_Service_read(client, request);
25524 
25527  retval = response.responseHeader.serviceResult;
25528  else if(response.resultsSize != 1 || !response.results[0].hasValue)
25530  else if(response.results[0].value.type != &UA_TYPES[UA_TYPES_STRING])
25532 
25533  if(retval != UA_STATUSCODE_GOOD) {
25534  UA_ReadResponse_deleteMembers(&response);
25535  return retval;
25536  }
25537 
25538  retval = UA_STATUSCODE_BADNOTFOUND;
25539  UA_String *ns = response.results[0].value.data;
25540  for(size_t i = 0; i < response.results[0].value.arrayLength; ++i){
25541  if(UA_String_equal(namespaceUri, &ns[i])) {
25542  *namespaceIndex = (UA_UInt16)i;
25543  retval = UA_STATUSCODE_GOOD;
25544  break;
25545  }
25546  }
25547 
25548  UA_ReadResponse_deleteMembers(&response);
25549  return retval;
25550 }
25551 
25554  UA_NodeIteratorCallback callback, void *handle) {
25555  UA_BrowseRequest bReq;
25556  UA_BrowseRequest_init(&bReq);
25558  bReq.nodesToBrowse = UA_BrowseDescription_new();
25559  bReq.nodesToBrowseSize = 1;
25560  UA_NodeId_copy(&parentNodeId, &bReq.nodesToBrowse[0].nodeId);
25561  bReq.nodesToBrowse[0].resultMask = UA_BROWSERESULTMASK_ALL; //return everything
25563 
25564  UA_BrowseResponse bResp = UA_Client_Service_browse(client, bReq);
25565 
25568  for (size_t i = 0; i < bResp.resultsSize; ++i) {
25569  for (size_t j = 0; j < bResp.results[i].referencesSize; ++j) {
25570  UA_ReferenceDescription *ref = &(bResp.results[i].references[j]);
25571  retval |= callback(ref->nodeId.nodeId, !ref->isForward,
25572  ref->referenceTypeId, handle);
25573  }
25574  }
25575  }
25576  else
25577  retval = bResp.responseHeader.serviceResult;
25578 
25579 
25580  UA_BrowseRequest_deleteMembers(&bReq);
25581  UA_BrowseResponse_deleteMembers(&bResp);
25582 
25583  return retval;
25584 }
25585 
25586 /*******************/
25587 /* Node Management */
25588 /*******************/
25589 
25591 UA_Client_addReference(UA_Client *client, const UA_NodeId sourceNodeId,
25592  const UA_NodeId referenceTypeId, UA_Boolean isForward,
25593  const UA_String targetServerUri,
25594  const UA_ExpandedNodeId targetNodeId,
25595  UA_NodeClass targetNodeClass) {
25596  UA_AddReferencesItem item;
25597  UA_AddReferencesItem_init(&item);
25598  item.sourceNodeId = sourceNodeId;
25599  item.referenceTypeId = referenceTypeId;
25600  item.isForward = isForward;
25601  item.targetServerUri = targetServerUri;
25602  item.targetNodeId = targetNodeId;
25603  item.targetNodeClass = targetNodeClass;
25604  UA_AddReferencesRequest request;
25605  UA_AddReferencesRequest_init(&request);
25606  request.referencesToAdd = &item;
25607  request.referencesToAddSize = 1;
25608  UA_AddReferencesResponse response = UA_Client_Service_addReferences(client, request);
25609  UA_StatusCode retval = response.responseHeader.serviceResult;
25610  if(retval != UA_STATUSCODE_GOOD) {
25611  UA_AddReferencesResponse_deleteMembers(&response);
25612  return retval;
25613  }
25614  if(response.resultsSize != 1) {
25615  UA_AddReferencesResponse_deleteMembers(&response);
25617  }
25618  retval = response.results[0];
25619  UA_AddReferencesResponse_deleteMembers(&response);
25620  return retval;
25621 }
25622 
25624 UA_Client_deleteReference(UA_Client *client, const UA_NodeId sourceNodeId,
25625  const UA_NodeId referenceTypeId, UA_Boolean isForward,
25626  const UA_ExpandedNodeId targetNodeId,
25627  UA_Boolean deleteBidirectional) {
25629  UA_DeleteReferencesItem_init(&item);
25630  item.sourceNodeId = sourceNodeId;
25631  item.referenceTypeId = referenceTypeId;
25632  item.isForward = isForward;
25633  item.targetNodeId = targetNodeId;
25634  item.deleteBidirectional = deleteBidirectional;
25636  UA_DeleteReferencesRequest_init(&request);
25637  request.referencesToDelete = &item;
25638  request.referencesToDeleteSize = 1;
25639  UA_DeleteReferencesResponse response = UA_Client_Service_deleteReferences(client, request);
25640  UA_StatusCode retval = response.responseHeader.serviceResult;
25641  if(retval != UA_STATUSCODE_GOOD) {
25642  UA_DeleteReferencesResponse_deleteMembers(&response);
25643  return retval;
25644  }
25645  if(response.resultsSize != 1) {
25646  UA_DeleteReferencesResponse_deleteMembers(&response);
25648  }
25649  retval = response.results[0];
25650  UA_DeleteReferencesResponse_deleteMembers(&response);
25651  return retval;
25652 }
25653 
25656  UA_Boolean deleteTargetReferences) {
25657  UA_DeleteNodesItem item;
25658  UA_DeleteNodesItem_init(&item);
25659  item.nodeId = nodeId;
25660  item.deleteTargetReferences = deleteTargetReferences;
25661  UA_DeleteNodesRequest request;
25662  UA_DeleteNodesRequest_init(&request);
25663  request.nodesToDelete = &item;
25664  request.nodesToDeleteSize = 1;
25665  UA_DeleteNodesResponse response = UA_Client_Service_deleteNodes(client, request);
25666  UA_StatusCode retval = response.responseHeader.serviceResult;
25667  if(retval != UA_STATUSCODE_GOOD) {
25668  UA_DeleteNodesResponse_deleteMembers(&response);
25669  return retval;
25670  }
25671  if(response.resultsSize != 1) {
25672  UA_DeleteNodesResponse_deleteMembers(&response);
25674  }
25675  retval = response.results[0];
25676  UA_DeleteNodesResponse_deleteMembers(&response);
25677  return retval;
25678 }
25679 
25681 __UA_Client_addNode(UA_Client *client, const UA_NodeClass nodeClass,
25682  const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId,
25683  const UA_NodeId referenceTypeId, const UA_QualifiedName browseName,
25684  const UA_NodeId typeDefinition, const UA_NodeAttributes *attr,
25685  const UA_DataType *attributeType, UA_NodeId *outNewNodeId) {
25687  UA_AddNodesRequest request;
25688  UA_AddNodesRequest_init(&request);
25689  UA_AddNodesItem item;
25690  UA_AddNodesItem_init(&item);
25691  item.parentNodeId.nodeId = parentNodeId;
25692  item.referenceTypeId = referenceTypeId;
25693  item.requestedNewNodeId.nodeId = requestedNewNodeId;
25694  item.browseName = browseName;
25695  item.nodeClass = nodeClass;
25696  item.typeDefinition.nodeId = typeDefinition;
25698  item.nodeAttributes.content.decoded.type = attributeType;
25699  item.nodeAttributes.content.decoded.data = (void*)(uintptr_t)attr; // hack. is not written into.
25700  request.nodesToAdd = &item;
25701  request.nodesToAddSize = 1;
25702  UA_AddNodesResponse response = UA_Client_Service_addNodes(client, request);
25704  retval = response.responseHeader.serviceResult;
25705  UA_AddNodesResponse_deleteMembers(&response);
25706  return retval;
25707  }
25708  if(response.resultsSize != 1) {
25709  UA_AddNodesResponse_deleteMembers(&response);
25711  }
25712  if(outNewNodeId && response.results[0].statusCode == UA_STATUSCODE_GOOD) {
25713  *outNewNodeId = response.results[0].addedNodeId;
25714  UA_NodeId_init(&response.results[0].addedNodeId);
25715  }
25716  retval = response.results[0].statusCode;
25717  UA_AddNodesResponse_deleteMembers(&response);
25718  return retval;
25719 }
25720 
25721 /********/
25722 /* Call */
25723 /********/
25724 
25725 #ifdef UA_ENABLE_METHODCALLS
25726 
25728 UA_Client_call(UA_Client *client, const UA_NodeId objectId,
25729  const UA_NodeId methodId, size_t inputSize,
25730  const UA_Variant *input, size_t *outputSize,
25731  UA_Variant **output) {
25732  /* Set up the request */
25733  UA_CallRequest request;
25734  UA_CallRequest_init(&request);
25735  UA_CallMethodRequest item;
25736  UA_CallMethodRequest_init(&item);
25737  item.methodId = methodId;
25738  item.objectId = objectId;
25739  item.inputArguments = (void*)(uintptr_t)input; // cast const...
25740  item.inputArgumentsSize = inputSize;
25741  request.methodsToCall = &item;
25742  request.methodsToCallSize = 1;
25743 
25744  /* Call the service */
25745  UA_CallResponse response = UA_Client_Service_call(client, request);
25746  UA_StatusCode retval = response.responseHeader.serviceResult;
25747  if(retval == UA_STATUSCODE_GOOD) {
25748  if(response.resultsSize == 1)
25749  retval = response.results[0].statusCode;
25750  else
25752  }
25753  if(retval != UA_STATUSCODE_GOOD) {
25754  UA_CallResponse_deleteMembers(&response);
25755  return retval;
25756  }
25757 
25758  /* Move the output arguments */
25759  if(output != NULL && outputSize != NULL) {
25760  *output = response.results[0].outputArguments;
25761  *outputSize = response.results[0].outputArgumentsSize;
25762  response.results[0].outputArguments = NULL;
25763  response.results[0].outputArgumentsSize = 0;
25764  }
25765  UA_CallResponse_deleteMembers(&response);
25766  return retval;
25767 }
25768 
25769 #endif
25770 
25771 /********************/
25772 /* Write Attributes */
25773 /********************/
25774 
25777  UA_AttributeId attributeId, const void *in,
25778  const UA_DataType *inDataType) {
25779  if(!in)
25781 
25782  UA_WriteValue wValue;
25783  UA_WriteValue_init(&wValue);
25784  wValue.nodeId = *nodeId;
25785  wValue.attributeId = attributeId;
25786  if(attributeId == UA_ATTRIBUTEID_VALUE)
25787  wValue.value.value = *(const UA_Variant*)in;
25788  else
25789  /* hack. is never written into. */
25790  UA_Variant_setScalar(&wValue.value.value, (void*)(uintptr_t)in, inDataType);
25791  wValue.value.hasValue = true;
25792  UA_WriteRequest wReq;
25793  UA_WriteRequest_init(&wReq);
25794  wReq.nodesToWrite = &wValue;
25795  wReq.nodesToWriteSize = 1;
25796 
25797  UA_WriteResponse wResp = UA_Client_Service_write(client, wReq);
25798 
25800  if(retval == UA_STATUSCODE_GOOD) {
25801  if(wResp.resultsSize == 1)
25802  retval = wResp.results[0];
25803  else
25805  }
25806 
25807  UA_WriteResponse_deleteMembers(&wResp);
25808  return retval;
25809 }
25810 
25813  const UA_UInt32 *newArrayDimensions,
25814  size_t newArrayDimensionsSize) {
25815  if(!newArrayDimensions)
25817 
25818  UA_WriteValue wValue;
25819  UA_WriteValue_init(&wValue);
25820  wValue.nodeId = nodeId;
25822  UA_Variant_setArray(&wValue.value.value, (void*)(uintptr_t)newArrayDimensions,
25823  newArrayDimensionsSize, &UA_TYPES[UA_TYPES_UINT32]);
25824  wValue.value.hasValue = true;
25825  UA_WriteRequest wReq;
25826  UA_WriteRequest_init(&wReq);
25827  wReq.nodesToWrite = &wValue;
25828  wReq.nodesToWriteSize = 1;
25829 
25830  UA_WriteResponse wResp = UA_Client_Service_write(client, wReq);
25831 
25833  if(retval == UA_STATUSCODE_GOOD) {
25834  if(wResp.resultsSize == 1)
25835  retval = wResp.results[0];
25836  else
25838  }
25839  UA_WriteResponse_deleteMembers(&wResp);
25840  return retval;
25841 }
25842 
25843 /*******************/
25844 /* Read Attributes */
25845 /*******************/
25846 
25849  UA_AttributeId attributeId, void *out,
25850  const UA_DataType *outDataType) {
25851  UA_ReadValueId item;
25852  UA_ReadValueId_init(&item);
25853  item.nodeId = *nodeId;
25854  item.attributeId = attributeId;
25855  UA_ReadRequest request;
25856  UA_ReadRequest_init(&request);
25857  request.nodesToRead = &item;
25858  request.nodesToReadSize = 1;
25859  UA_ReadResponse response = UA_Client_Service_read(client, request);
25860  UA_StatusCode retval = response.responseHeader.serviceResult;
25861  if(retval == UA_STATUSCODE_GOOD) {
25862  if(response.resultsSize == 1)
25863  retval = response.results[0].status;
25864  else
25866  }
25867  if(retval != UA_STATUSCODE_GOOD) {
25868  UA_ReadResponse_deleteMembers(&response);
25869  return retval;
25870  }
25871 
25872  /* Set the StatusCode */
25873  UA_DataValue *res = response.results;
25874  if(res->hasStatus)
25875  retval = res->status;
25876 
25877  /* Return early of no value is given */
25878  if(!res->hasValue) {
25879  if(retval == UA_STATUSCODE_GOOD)
25881  UA_ReadResponse_deleteMembers(&response);
25882  return retval;
25883  }
25884 
25885  /* Copy value into out */
25886  if(attributeId == UA_ATTRIBUTEID_VALUE) {
25887  memcpy(out, &res->value, sizeof(UA_Variant));
25888  UA_Variant_init(&res->value);
25889  } else if(attributeId == UA_ATTRIBUTEID_NODECLASS) {
25890  memcpy(out, (UA_NodeClass*)res->value.data, sizeof(UA_NodeClass));
25891  } else if(UA_Variant_isScalar(&res->value) &&
25892  res->value.type == outDataType) {
25893  memcpy(out, res->value.data, res->value.type->memSize);
25894  UA_free(res->value.data);
25895  res->value.data = NULL;
25896  } else {
25898  }
25899 
25900  UA_ReadResponse_deleteMembers(&response);
25901  return retval;
25902 }
25903 
25906  UA_UInt32 **outArrayDimensions,
25907  size_t *outArrayDimensionsSize) {
25908  UA_ReadValueId item;
25909  UA_ReadValueId_init(&item);
25910  item.nodeId = nodeId;
25912  UA_ReadRequest request;
25913  UA_ReadRequest_init(&request);
25914  request.nodesToRead = &item;
25915  request.nodesToReadSize = 1;
25916  UA_ReadResponse response = UA_Client_Service_read(client, request);
25917  UA_StatusCode retval = response.responseHeader.serviceResult;
25918  if(retval == UA_STATUSCODE_GOOD) {
25919  if(response.resultsSize == 1)
25920  retval = response.results[0].status;
25921  else
25923  }
25924  if(retval != UA_STATUSCODE_GOOD)
25925  goto cleanup;
25926 
25927  UA_DataValue *res = response.results;
25928  if(res->hasStatus != UA_STATUSCODE_GOOD)
25929  retval = res->hasStatus;
25930  else if(!res->hasValue || UA_Variant_isScalar(&res->value))
25932  if(retval != UA_STATUSCODE_GOOD)
25933  goto cleanup;
25934 
25935  if(UA_Variant_isScalar(&res->value) ||
25936  res->value.type != &UA_TYPES[UA_TYPES_UINT32]) {
25938  goto cleanup;
25939  }
25940 
25941  /* Move data out of the results structure instead of copying */
25942  *outArrayDimensions = res->value.data;
25943  *outArrayDimensionsSize = res->value.arrayLength;
25944  res->value.data = NULL;
25945  res->value.arrayLength = 0;
25946 
25947  cleanup:
25948  UA_ReadResponse_deleteMembers(&response);
25949  return retval;
25950 
25951 }
25952 
25953 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/client/ua_client_highlevel_subscriptions.c" ***********************************/
25954 
25955 /* This Source Code Form is subject to the terms of the Mozilla Public
25956 * License, v. 2.0. If a copy of the MPL was not distributed with this
25957 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
25958 
25959 
25960 #ifdef UA_ENABLE_SUBSCRIPTIONS /* conditional compilation */
25961 
25963 UA_Client_Subscriptions_new(UA_Client *client, UA_SubscriptionSettings settings,
25964  UA_UInt32 *newSubscriptionId) {
25966  UA_CreateSubscriptionRequest_init(&request);
25967  request.requestedPublishingInterval = settings.requestedPublishingInterval;
25968  request.requestedLifetimeCount = settings.requestedLifetimeCount;
25969  request.requestedMaxKeepAliveCount = settings.requestedMaxKeepAliveCount;
25970  request.maxNotificationsPerPublish = settings.maxNotificationsPerPublish;
25971  request.publishingEnabled = settings.publishingEnabled;
25972  request.priority = settings.priority;
25973 
25974  UA_CreateSubscriptionResponse response = UA_Client_Service_createSubscription(client, request);
25975  UA_StatusCode retval = response.responseHeader.serviceResult;
25976  if(retval != UA_STATUSCODE_GOOD)
25977  goto cleanup;
25978 
25979  UA_Client_Subscription *newSub = UA_malloc(sizeof(UA_Client_Subscription));
25980  if(!newSub) {
25982  goto cleanup;
25983  }
25984 
25985  LIST_INIT(&newSub->monitoredItems);
25986  newSub->lifeTime = response.revisedLifetimeCount;
25987  newSub->keepAliveCount = response.revisedMaxKeepAliveCount;
25988  newSub->publishingInterval = response.revisedPublishingInterval;
25989  newSub->subscriptionID = response.subscriptionId;
25990  newSub->notificationsPerPublish = request.maxNotificationsPerPublish;
25991  newSub->priority = request.priority;
25992  LIST_INSERT_HEAD(&client->subscriptions, newSub, listEntry);
25993 
25994  if(newSubscriptionId)
25995  *newSubscriptionId = newSub->subscriptionID;
25996 
25997  cleanup:
25998  UA_CreateSubscriptionResponse_deleteMembers(&response);
25999  return retval;
26000 }
26001 
26002 /* remove the subscription remotely */
26004 UA_Client_Subscriptions_remove(UA_Client *client, UA_UInt32 subscriptionId) {
26005  UA_Client_Subscription *sub;
26006  LIST_FOREACH(sub, &client->subscriptions, listEntry) {
26007  if(sub->subscriptionID == subscriptionId)
26008  break;
26009  }
26010  if(!sub)
26012 
26014  UA_Client_MonitoredItem *mon, *tmpmon;
26015  LIST_FOREACH_SAFE(mon, &sub->monitoredItems, listEntry, tmpmon) {
26016  retval =
26017  UA_Client_Subscriptions_removeMonitoredItem(client, sub->subscriptionID,
26018  mon->monitoredItemId);
26019  if(retval != UA_STATUSCODE_GOOD)
26020  return retval;
26021  }
26022 
26023  /* remove the subscription remotely */
26025  UA_DeleteSubscriptionsRequest_init(&request);
26026  request.subscriptionIdsSize = 1;
26027  request.subscriptionIds = &sub->subscriptionID;
26028  UA_DeleteSubscriptionsResponse response = UA_Client_Service_deleteSubscriptions(client, request);
26029  retval = response.responseHeader.serviceResult;
26030  if(retval == UA_STATUSCODE_GOOD && response.resultsSize > 0)
26031  retval = response.results[0];
26032  UA_DeleteSubscriptionsResponse_deleteMembers(&response);
26033 
26034  if(retval != UA_STATUSCODE_GOOD && retval != UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID) {
26035  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_CLIENT,
26036  "Could not remove subscription %u with error code %s",
26037  sub->subscriptionID, UA_StatusCode_name(retval));
26038  return retval;
26039  }
26040 
26041  UA_Client_Subscriptions_forceDelete(client, sub);
26042  return UA_STATUSCODE_GOOD;
26043 }
26044 
26045 void
26046 UA_Client_Subscriptions_forceDelete(UA_Client *client,
26047  UA_Client_Subscription *sub) {
26048  UA_Client_MonitoredItem *mon, *mon_tmp;
26049  LIST_FOREACH_SAFE(mon, &sub->monitoredItems, listEntry, mon_tmp) {
26050  UA_NodeId_deleteMembers(&mon->monitoredNodeId);
26051  LIST_REMOVE(mon, listEntry);
26052  UA_free(mon);
26053  }
26054  LIST_REMOVE(sub, listEntry);
26055  UA_free(sub);
26056 }
26057 
26059 UA_Client_Subscriptions_addMonitoredItem(UA_Client *client, UA_UInt32 subscriptionId,
26060  UA_NodeId nodeId, UA_UInt32 attributeID,
26061  UA_MonitoredItemHandlingFunction hf,
26062  void *hfContext, UA_UInt32 *newMonitoredItemId) {
26063  UA_Client_Subscription *sub;
26064  LIST_FOREACH(sub, &client->subscriptions, listEntry) {
26065  if(sub->subscriptionID == subscriptionId)
26066  break;
26067  }
26068  if(!sub)
26070 
26071  /* Create the handler */
26072  UA_Client_MonitoredItem *newMon = UA_malloc(sizeof(UA_Client_MonitoredItem));
26073  if(!newMon)
26075 
26076  /* Send the request */
26078  UA_CreateMonitoredItemsRequest_init(&request);
26079  request.subscriptionId = subscriptionId;
26081  UA_MonitoredItemCreateRequest_init(&item);
26082  item.itemToMonitor.nodeId = nodeId;
26083  item.itemToMonitor.attributeId = attributeID;
26085  item.requestedParameters.clientHandle = ++(client->monitoredItemHandles);
26086  item.requestedParameters.samplingInterval = sub->publishingInterval;
26087  item.requestedParameters.discardOldest = true;
26088  item.requestedParameters.queueSize = 1;
26089  request.itemsToCreate = &item;
26090  request.itemsToCreateSize = 1;
26091  UA_CreateMonitoredItemsResponse response = UA_Client_Service_createMonitoredItems(client, request);
26092 
26093  // slight misuse of retval here to check if the addition was successfull.
26094  UA_StatusCode retval = response.responseHeader.serviceResult;
26095  if(retval == UA_STATUSCODE_GOOD) {
26096  if(response.resultsSize == 1)
26097  retval = response.results[0].statusCode;
26098  else
26100  }
26101  if(retval != UA_STATUSCODE_GOOD) {
26102  UA_free(newMon);
26103  UA_CreateMonitoredItemsResponse_deleteMembers(&response);
26104  return retval;
26105  }
26106 
26107  /* Set the handler */
26108  newMon->monitoringMode = UA_MONITORINGMODE_REPORTING;
26109  UA_NodeId_copy(&nodeId, &newMon->monitoredNodeId);
26110  newMon->attributeID = attributeID;
26111  newMon->clientHandle = client->monitoredItemHandles;
26112  newMon->samplingInterval = sub->publishingInterval;
26113  newMon->queueSize = 1;
26114  newMon->discardOldest = true;
26115  newMon->handler = hf;
26116  newMon->handlerContext = hfContext;
26117  newMon->monitoredItemId = response.results[0].monitoredItemId;
26118  LIST_INSERT_HEAD(&sub->monitoredItems, newMon, listEntry);
26119  *newMonitoredItemId = newMon->monitoredItemId;
26120 
26121  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
26122  "Created a monitored item with client handle %u",
26123  client->monitoredItemHandles);
26124 
26125  UA_CreateMonitoredItemsResponse_deleteMembers(&response);
26126  return UA_STATUSCODE_GOOD;
26127 }
26128 
26130 UA_Client_Subscriptions_removeMonitoredItem(UA_Client *client, UA_UInt32 subscriptionId,
26131  UA_UInt32 monitoredItemId) {
26132  UA_Client_Subscription *sub;
26133  LIST_FOREACH(sub, &client->subscriptions, listEntry) {
26134  if(sub->subscriptionID == subscriptionId)
26135  break;
26136  }
26137  if(!sub)
26139 
26140  UA_Client_MonitoredItem *mon;
26141  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
26142  if(mon->monitoredItemId == monitoredItemId)
26143  break;
26144  }
26145  if(!mon)
26147 
26148  /* remove the monitoreditem remotely */
26150  UA_DeleteMonitoredItemsRequest_init(&request);
26151  request.subscriptionId = sub->subscriptionID;
26152  request.monitoredItemIdsSize = 1;
26153  request.monitoredItemIds = &mon->monitoredItemId;
26154  UA_DeleteMonitoredItemsResponse response = UA_Client_Service_deleteMonitoredItems(client, request);
26155 
26156  UA_StatusCode retval = response.responseHeader.serviceResult;
26157  if(retval == UA_STATUSCODE_GOOD && response.resultsSize > 1)
26158  retval = response.results[0];
26159  UA_DeleteMonitoredItemsResponse_deleteMembers(&response);
26160  if(retval != UA_STATUSCODE_GOOD &&
26162  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_CLIENT,
26163  "Could not remove monitoreditem %u with error code %s",
26164  monitoredItemId, UA_StatusCode_name(retval));
26165  return retval;
26166  }
26167 
26168  LIST_REMOVE(mon, listEntry);
26169  UA_NodeId_deleteMembers(&mon->monitoredNodeId);
26170  UA_free(mon);
26171  return UA_STATUSCODE_GOOD;
26172 }
26173 
26174 static void
26175 UA_Client_processPublishResponse(UA_Client *client, UA_PublishRequest *request,
26176  UA_PublishResponse *response) {
26178  return;
26179 
26180  /* Find the subscription */
26181  UA_Client_Subscription *sub;
26182  LIST_FOREACH(sub, &client->subscriptions, listEntry) {
26183  if(sub->subscriptionID == response->subscriptionId)
26184  break;
26185  }
26186  if(!sub)
26187  return;
26188 
26189  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
26190  "Processing a publish response on subscription %u with %u notifications",
26191  sub->subscriptionID, response->notificationMessage.notificationDataSize);
26192 
26193  /* Check if the server has acknowledged any of the sent ACKs */
26194  for(size_t i = 0; i < response->resultsSize && i < request->subscriptionAcknowledgementsSize; ++i) {
26195  /* remove also acks that are unknown to the server */
26196  if(response->results[i] != UA_STATUSCODE_GOOD &&
26198  continue;
26199 
26200  /* Remove the ack from the list */
26202  UA_Client_NotificationsAckNumber *ack;
26203  LIST_FOREACH(ack, &client->pendingNotificationsAcks, listEntry) {
26204  if(ack->subAck.subscriptionId == orig_ack->subscriptionId &&
26205  ack->subAck.sequenceNumber == orig_ack->sequenceNumber) {
26206  LIST_REMOVE(ack, listEntry);
26207  UA_free(ack);
26208  UA_assert(ack != LIST_FIRST(&client->pendingNotificationsAcks));
26209  break;
26210  }
26211  }
26212  }
26213 
26214  /* Process the notification messages */
26215  UA_NotificationMessage *msg = &response->notificationMessage;
26216  for(size_t k = 0; k < msg->notificationDataSize; ++k) {
26218  continue;
26219 
26220  /* Currently only dataChangeNotifications are supported */
26222  continue;
26223 
26224  UA_DataChangeNotification *dataChangeNotification = msg->notificationData[k].content.decoded.data;
26225  for(size_t j = 0; j < dataChangeNotification->monitoredItemsSize; ++j) {
26226  UA_MonitoredItemNotification *mitemNot = &dataChangeNotification->monitoredItems[j];
26227  UA_Client_MonitoredItem *mon;
26228  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
26229  if(mon->clientHandle == mitemNot->clientHandle) {
26230  mon->handler(mon->monitoredItemId, &mitemNot->value, mon->handlerContext);
26231  break;
26232  }
26233  }
26234  if(!mon)
26235  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
26236  "Could not process a notification with clienthandle %u on subscription %u",
26237  mitemNot->clientHandle, sub->subscriptionID);
26238  }
26239  }
26240 
26241  /* Add to the list of pending acks */
26242  UA_Client_NotificationsAckNumber *tmpAck = UA_malloc(sizeof(UA_Client_NotificationsAckNumber));
26243  if(!tmpAck) {
26244  UA_LOG_WARNING(client->config.logger, UA_LOGCATEGORY_CLIENT,
26245  "Not enough memory to store the acknowledgement for a "
26246  "publish message on subscription %u", sub->subscriptionID);
26247  return;
26248  }
26249  tmpAck->subAck.sequenceNumber = msg->sequenceNumber;
26250  tmpAck->subAck.subscriptionId = sub->subscriptionID;
26251  LIST_INSERT_HEAD(&client->pendingNotificationsAcks, tmpAck, listEntry);
26252 }
26253 
26255 UA_Client_Subscriptions_manuallySendPublishRequest(UA_Client *client) {
26256  if (client->state == UA_CLIENTSTATE_ERRORED)
26258 
26259  UA_Boolean moreNotifications = true;
26260  while(moreNotifications) {
26261  UA_PublishRequest request;
26262  UA_PublishRequest_init(&request);
26264 
26265  UA_Client_NotificationsAckNumber *ack;
26266  LIST_FOREACH(ack, &client->pendingNotificationsAcks, listEntry)
26268  if(request.subscriptionAcknowledgementsSize > 0) {
26271  if(!request.subscriptionAcknowledgements)
26272  return UA_STATUSCODE_GOOD;
26273  }
26274 
26275  int i = 0;
26276  LIST_FOREACH(ack, &client->pendingNotificationsAcks, listEntry) {
26277  request.subscriptionAcknowledgements[i].sequenceNumber = ack->subAck.sequenceNumber;
26278  request.subscriptionAcknowledgements[i].subscriptionId = ack->subAck.subscriptionId;
26279  ++i;
26280  }
26281 
26282  UA_PublishResponse response = UA_Client_Service_publish(client, request);
26283  UA_Client_processPublishResponse(client, &request, &response);
26284  moreNotifications = response.moreNotifications;
26285 
26286  UA_PublishResponse_deleteMembers(&response);
26287  UA_PublishRequest_deleteMembers(&request);
26288  }
26289  return UA_STATUSCODE_GOOD;
26290 }
26291 
26292 #endif /* UA_ENABLE_SUBSCRIPTIONS */
26293 
26294 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/libc_time.c" ***********************************/
26295 
26296 /*
26297  * Originally released by the musl project (http://www.musl-libc.org/) under the
26298  * MIT license. Taken from the file /src/time/__secs_to_tm.c
26299  */
26300 
26301 
26302 /* 2000-03-01 (mod 400 year, immediately after feb29 */
26303 #define LEAPOCH (946684800LL + 86400*(31+29))
26304 
26305 #define DAYS_PER_400Y (365*400 + 97)
26306 #define DAYS_PER_100Y (365*100 + 24)
26307 #define DAYS_PER_4Y (365*4 + 1)
26308 
26309 int __secs_to_tm(long long t, struct tm *tm)
26310 {
26311  long long days, secs, years;
26312  int remdays, remsecs, remyears;
26313  int qc_cycles, c_cycles, q_cycles;
26314  int months;
26315  int wday, yday, leap;
26316  static const char days_in_month[] = {31,30,31,30,31,31,30,31,30,31,31,29};
26317 
26318  /* Reject time_t values whose year would overflow int */
26319  if (t < INT_MIN * 31622400LL || t > INT_MAX * 31622400LL)
26320  return -1;
26321 
26322  secs = t - LEAPOCH;
26323  days = secs / 86400LL;
26324  remsecs = (int)(secs % 86400);
26325  if (remsecs < 0) {
26326  remsecs += 86400;
26327  --days;
26328  }
26329 
26330  wday = (int)((3+days)%7);
26331  if (wday < 0) wday += 7;
26332 
26333  qc_cycles = (int)(days / DAYS_PER_400Y);
26334  remdays = (int)(days % DAYS_PER_400Y);
26335  if (remdays < 0) {
26336  remdays += DAYS_PER_400Y;
26337  --qc_cycles;
26338  }
26339 
26340  c_cycles = remdays / DAYS_PER_100Y;
26341  if (c_cycles == 4) --c_cycles;
26342  remdays -= c_cycles * DAYS_PER_100Y;
26343 
26344  q_cycles = remdays / DAYS_PER_4Y;
26345  if (q_cycles == 25) --q_cycles;
26346  remdays -= q_cycles * DAYS_PER_4Y;
26347 
26348  remyears = remdays / 365;
26349  if (remyears == 4) --remyears;
26350  remdays -= remyears * 365;
26351 
26352  leap = !remyears && (q_cycles || !c_cycles);
26353  yday = remdays + 31 + 28 + leap;
26354  if (yday >= 365+leap) yday -= 365+leap;
26355 
26356  years = remyears + 4*q_cycles + 100*c_cycles + 400LL*qc_cycles;
26357 
26358  for (months=0; days_in_month[months] <= remdays; ++months)
26359  remdays -= days_in_month[months];
26360 
26361  if (years+100 > INT_MAX || years+100 < INT_MIN)
26362  return -1;
26363 
26364  tm->tm_year = (int)(years + 100);
26365  tm->tm_mon = months + 2;
26366  if (tm->tm_mon >= 12) {
26367  tm->tm_mon -=12;
26368  ++tm->tm_year;
26369  }
26370  tm->tm_mday = remdays + 1;
26371  tm->tm_wday = wday;
26372  tm->tm_yday = yday;
26373 
26374  tm->tm_hour = remsecs / 3600;
26375  tm->tm_min = remsecs / 60 % 60;
26376  tm->tm_sec = remsecs % 60;
26377 
26378  return 0;
26379 }
26380 
26381 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/pcg_basic.c" ***********************************/
26382 
26383 /*
26384  * PCG Random Number Generation for C.
26385  *
26386  * Copyright 2014 Melissa O'Neill <oneill@pcg-random.org>
26387  *
26388  * Licensed under the Apache License, Version 2.0 (the "License");
26389  * you may not use this file except in compliance with the License.
26390  * You may obtain a copy of the License at
26391  *
26392  * http://www.apache.org/licenses/LICENSE-2.0
26393  *
26394  * Unless required by applicable law or agreed to in writing, software
26395  * distributed under the License is distributed on an "AS IS" BASIS,
26396  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26397  * See the License for the specific language governing permissions and
26398  * limitations under the License.
26399  *
26400  * For additional information about the PCG random number generation scheme,
26401  * including its license and other licensing options, visit
26402  *
26403  * http://www.pcg-random.org
26404  */
26405 
26406 
26407 void pcg32_srandom_r(pcg32_random_t* rng, uint64_t initial_state, uint64_t initseq) {
26408  rng->state = 0U;
26409  rng->inc = (initseq << 1u) | 1u;
26410  pcg32_random_r(rng);
26411  rng->state += initial_state;
26412  pcg32_random_r(rng);
26413 }
26414 
26416  uint64_t oldstate = rng->state;
26417  rng->state = oldstate * 6364136223846793005ULL + rng->inc;
26418  uint32_t xorshifted = (uint32_t)(((oldstate >> 18u) ^ oldstate) >> 27u);
26419  uint32_t rot = (uint32_t)(oldstate >> 59u);
26420  return (xorshifted >> rot) | (xorshifted << ((~rot + 1u) & 31)); /* was (xorshifted >> rot) | (xorshifted << ((-rot) & 31)) */
26421 }
26422 
26423 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_statuscode_descriptions.c" ***********************************/
26424 
26425 /**********************************************************
26426  * Autogenerated -- do not modify
26427  * Generated from /home/iosb/sw/open62541/tools/schema/Opc.Ua.StatusCodes.csv with script /home/iosb/sw/open62541/tools/generate_statuscode_descriptions.py
26428  *********************************************************/
26429 
26430 
26431 #ifndef UA_ENABLE_STATUSCODE_DESCRIPTIONS
26432 static const size_t statusCodeDescriptionsSize = 1;
26433 static const UA_StatusCodeDescription statusCodeDescriptions[1] = {
26434  {0xffffffff, "StatusCode descriptions not available", "open62541 was compiled without support for statuscode descriptions"}
26435 };
26436 #else
26437 static const size_t statusCodeDescriptionsSize = 229;
26438 static const UA_StatusCodeDescription statusCodeDescriptions[229] =
26439 {
26440  {UA_STATUSCODE_GOOD, "Good", "Success / No error"},
26441  {UA_STATUSCODE_BADUNEXPECTEDERROR, "BadUnexpectedError", "An unexpected error occurred."},
26442  {UA_STATUSCODE_BADINTERNALERROR, "BadInternalError", "An internal error occurred as a result of a programming or configuration error."},
26443  {UA_STATUSCODE_BADOUTOFMEMORY, "BadOutOfMemory", "Not enough memory to complete the operation."},
26444  {UA_STATUSCODE_BADRESOURCEUNAVAILABLE, "BadResourceUnavailable", "An operating system resource is not available."},
26445  {UA_STATUSCODE_BADCOMMUNICATIONERROR, "BadCommunicationError", "A low level communication error occurred."},
26446  {UA_STATUSCODE_BADENCODINGERROR, "BadEncodingError", "Encoding halted because of invalid data in the objects being serialized."},
26447  {UA_STATUSCODE_BADDECODINGERROR, "BadDecodingError", "Decoding halted because of invalid data in the stream."},
26448  {UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED, "BadEncodingLimitsExceeded", "The message encoding/decoding limits imposed by the stack have been exceeded."},
26449  {UA_STATUSCODE_BADREQUESTTOOLARGE, "BadRequestTooLarge", "The request message size exceeds limits set by the server."},
26450  {UA_STATUSCODE_BADRESPONSETOOLARGE, "BadResponseTooLarge", "The response message size exceeds limits set by the client."},
26451  {UA_STATUSCODE_BADUNKNOWNRESPONSE, "BadUnknownResponse", "An unrecognized response was received from the server."},
26452  {UA_STATUSCODE_BADTIMEOUT, "BadTimeout", "The operation timed out."},
26453  {UA_STATUSCODE_BADSERVICEUNSUPPORTED, "BadServiceUnsupported", "The server does not support the requested service."},
26454  {UA_STATUSCODE_BADSHUTDOWN, "BadShutdown", "The operation was cancelled because the application is shutting down."},
26455  {UA_STATUSCODE_BADSERVERNOTCONNECTED, "BadServerNotConnected", "The operation could not complete because the client is not connected to the server."},
26456  {UA_STATUSCODE_BADSERVERHALTED, "BadServerHalted", "The server has stopped and cannot process any requests."},
26457  {UA_STATUSCODE_BADNOTHINGTODO, "BadNothingToDo", "There was nothing to do because the client passed a list of operations with no elements."},
26458  {UA_STATUSCODE_BADTOOMANYOPERATIONS, "BadTooManyOperations", "The request could not be processed because it specified too many operations."},
26459  {UA_STATUSCODE_BADTOOMANYMONITOREDITEMS, "BadTooManyMonitoredItems", "The request could not be processed because there are too many monitored items in the subscription."},
26460  {UA_STATUSCODE_BADDATATYPEIDUNKNOWN, "BadDataTypeIdUnknown", "The extension object cannot be (de)serialized because the data type id is not recognized."},
26461  {UA_STATUSCODE_BADCERTIFICATEINVALID, "BadCertificateInvalid", "The certificate provided as a parameter is not valid."},
26462  {UA_STATUSCODE_BADSECURITYCHECKSFAILED, "BadSecurityChecksFailed", "An error occurred verifying security."},
26463  {UA_STATUSCODE_BADCERTIFICATETIMEINVALID, "BadCertificateTimeInvalid", "The Certificate has expired or is not yet valid."},
26464  {UA_STATUSCODE_BADCERTIFICATEISSUERTIMEINVALID, "BadCertificateIssuerTimeInvalid", "An Issuer Certificate has expired or is not yet valid."},
26465  {UA_STATUSCODE_BADCERTIFICATEHOSTNAMEINVALID, "BadCertificateHostNameInvalid", "The HostName used to connect to a Server does not match a HostName in the Certificate."},
26466  {UA_STATUSCODE_BADCERTIFICATEURIINVALID, "BadCertificateUriInvalid", "The URI specified in the ApplicationDescription does not match the URI in the Certificate."},
26467  {UA_STATUSCODE_BADCERTIFICATEUSENOTALLOWED, "BadCertificateUseNotAllowed", "The Certificate may not be used for the requested operation."},
26468  {UA_STATUSCODE_BADCERTIFICATEISSUERUSENOTALLOWED, "BadCertificateIssuerUseNotAllowed", "The Issuer Certificate may not be used for the requested operation."},
26469  {UA_STATUSCODE_BADCERTIFICATEUNTRUSTED, "BadCertificateUntrusted", "The Certificate is not trusted."},
26470  {UA_STATUSCODE_BADCERTIFICATEREVOCATIONUNKNOWN, "BadCertificateRevocationUnknown", "It was not possible to determine if the Certificate has been revoked."},
26471  {UA_STATUSCODE_BADCERTIFICATEISSUERREVOCATIONUNKNOWN, "BadCertificateIssuerRevocationUnknown", "It was not possible to determine if the Issuer Certificate has been revoked."},
26472  {UA_STATUSCODE_BADCERTIFICATEREVOKED, "BadCertificateRevoked", "The certificate has been revoked."},
26473  {UA_STATUSCODE_BADCERTIFICATEISSUERREVOKED, "BadCertificateIssuerRevoked", "The issuer certificate has been revoked."},
26474  {UA_STATUSCODE_BADCERTIFICATECHAININCOMPLETE, "BadCertificateChainIncomplete", "The certificate chain is incomplete."},
26475  {UA_STATUSCODE_BADUSERACCESSDENIED, "BadUserAccessDenied", "User does not have permission to perform the requested operation."},
26476  {UA_STATUSCODE_BADIDENTITYTOKENINVALID, "BadIdentityTokenInvalid", "The user identity token is not valid."},
26477  {UA_STATUSCODE_BADIDENTITYTOKENREJECTED, "BadIdentityTokenRejected", "The user identity token is valid but the server has rejected it."},
26478  {UA_STATUSCODE_BADSECURECHANNELIDINVALID, "BadSecureChannelIdInvalid", "The specified secure channel is no longer valid."},
26479  {UA_STATUSCODE_BADINVALIDTIMESTAMP, "BadInvalidTimestamp", "The timestamp is outside the range allowed by the server."},
26480  {UA_STATUSCODE_BADNONCEINVALID, "BadNonceInvalid", "The nonce does appear to be not a random value or it is not the correct length."},
26481  {UA_STATUSCODE_BADSESSIONIDINVALID, "BadSessionIdInvalid", "The session id is not valid."},
26482  {UA_STATUSCODE_BADSESSIONCLOSED, "BadSessionClosed", "The session was closed by the client."},
26483  {UA_STATUSCODE_BADSESSIONNOTACTIVATED, "BadSessionNotActivated", "The session cannot be used because ActivateSession has not been called."},
26484  {UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID, "BadSubscriptionIdInvalid", "The subscription id is not valid."},
26485  {UA_STATUSCODE_BADREQUESTHEADERINVALID, "BadRequestHeaderInvalid", "The header for the request is missing or invalid."},
26486  {UA_STATUSCODE_BADTIMESTAMPSTORETURNINVALID, "BadTimestampsToReturnInvalid", "The timestamps to return parameter is invalid."},
26487  {UA_STATUSCODE_BADREQUESTCANCELLEDBYCLIENT, "BadRequestCancelledByClient", "The request was cancelled by the client."},
26488  {UA_STATUSCODE_BADTOOMANYARGUMENTS, "BadTooManyArguments", "Too many arguments were provided."},
26489  {UA_STATUSCODE_GOODSUBSCRIPTIONTRANSFERRED, "GoodSubscriptionTransferred", "The subscription was transferred to another session."},
26490  {UA_STATUSCODE_GOODCOMPLETESASYNCHRONOUSLY, "GoodCompletesAsynchronously", "The processing will complete asynchronously."},
26491  {UA_STATUSCODE_GOODOVERLOAD, "GoodOverload", "Sampling has slowed down due to resource limitations."},
26492  {UA_STATUSCODE_GOODCLAMPED, "GoodClamped", "The value written was accepted but was clamped."},
26493  {UA_STATUSCODE_BADNOCOMMUNICATION, "BadNoCommunication", "Communication with the data source is defined"},
26494  {UA_STATUSCODE_BADWAITINGFORINITIALDATA, "BadWaitingForInitialData", "Waiting for the server to obtain values from the underlying data source."},
26495  {UA_STATUSCODE_BADNODEIDINVALID, "BadNodeIdInvalid", "The syntax of the node id is not valid."},
26496  {UA_STATUSCODE_BADNODEIDUNKNOWN, "BadNodeIdUnknown", "The node id refers to a node that does not exist in the server address space."},
26497  {UA_STATUSCODE_BADATTRIBUTEIDINVALID, "BadAttributeIdInvalid", "The attribute is not supported for the specified Node."},
26498  {UA_STATUSCODE_BADINDEXRANGEINVALID, "BadIndexRangeInvalid", "The syntax of the index range parameter is invalid."},
26499  {UA_STATUSCODE_BADINDEXRANGENODATA, "BadIndexRangeNoData", "No data exists within the range of indexes specified."},
26500  {UA_STATUSCODE_BADDATAENCODINGINVALID, "BadDataEncodingInvalid", "The data encoding is invalid."},
26501  {UA_STATUSCODE_BADDATAENCODINGUNSUPPORTED, "BadDataEncodingUnsupported", "The server does not support the requested data encoding for the node."},
26502  {UA_STATUSCODE_BADNOTREADABLE, "BadNotReadable", "The access level does not allow reading or subscribing to the Node."},
26503  {UA_STATUSCODE_BADNOTWRITABLE, "BadNotWritable", "The access level does not allow writing to the Node."},
26504  {UA_STATUSCODE_BADOUTOFRANGE, "BadOutOfRange", "The value was out of range."},
26505  {UA_STATUSCODE_BADNOTSUPPORTED, "BadNotSupported", "The requested operation is not supported."},
26506  {UA_STATUSCODE_BADNOTFOUND, "BadNotFound", "A requested item was not found or a search operation ended without success."},
26507  {UA_STATUSCODE_BADOBJECTDELETED, "BadObjectDeleted", "The object cannot be used because it has been deleted."},
26508  {UA_STATUSCODE_BADNOTIMPLEMENTED, "BadNotImplemented", "Requested operation is not implemented."},
26509  {UA_STATUSCODE_BADMONITORINGMODEINVALID, "BadMonitoringModeInvalid", "The monitoring mode is invalid."},
26510  {UA_STATUSCODE_BADMONITOREDITEMIDINVALID, "BadMonitoredItemIdInvalid", "The monitoring item id does not refer to a valid monitored item."},
26511  {UA_STATUSCODE_BADMONITOREDITEMFILTERINVALID, "BadMonitoredItemFilterInvalid", "The monitored item filter parameter is not valid."},
26512  {UA_STATUSCODE_BADMONITOREDITEMFILTERUNSUPPORTED, "BadMonitoredItemFilterUnsupported", "The server does not support the requested monitored item filter."},
26513  {UA_STATUSCODE_BADFILTERNOTALLOWED, "BadFilterNotAllowed", "A monitoring filter cannot be used in combination with the attribute specified."},
26514  {UA_STATUSCODE_BADSTRUCTUREMISSING, "BadStructureMissing", "A mandatory structured parameter was missing or null."},
26515  {UA_STATUSCODE_BADEVENTFILTERINVALID, "BadEventFilterInvalid", "The event filter is not valid."},
26516  {UA_STATUSCODE_BADCONTENTFILTERINVALID, "BadContentFilterInvalid", "The content filter is not valid."},
26517  {UA_STATUSCODE_BADFILTEROPERATORINVALID, "BadFilterOperatorInvalid", "An unregognized operator was provided in a filter."},
26518  {UA_STATUSCODE_BADFILTEROPERATORUNSUPPORTED, "BadFilterOperatorUnsupported", "A valid operator was provided"},
26519  {UA_STATUSCODE_BADFILTEROPERANDCOUNTMISMATCH, "BadFilterOperandCountMismatch", "The number of operands provided for the filter operator was less then expected for the operand provided."},
26520  {UA_STATUSCODE_BADFILTEROPERANDINVALID, "BadFilterOperandInvalid", "The operand used in a content filter is not valid."},
26521  {UA_STATUSCODE_BADFILTERELEMENTINVALID, "BadFilterElementInvalid", "The referenced element is not a valid element in the content filter."},
26522  {UA_STATUSCODE_BADFILTERLITERALINVALID, "BadFilterLiteralInvalid", "The referenced literal is not a valid value."},
26523  {UA_STATUSCODE_BADCONTINUATIONPOINTINVALID, "BadContinuationPointInvalid", "The continuation point provide is longer valid."},
26524  {UA_STATUSCODE_BADNOCONTINUATIONPOINTS, "BadNoContinuationPoints", "The operation could not be processed because all continuation points have been allocated."},
26525  {UA_STATUSCODE_BADREFERENCETYPEIDINVALID, "BadReferenceTypeIdInvalid", "The operation could not be processed because all continuation points have been allocated."},
26526  {UA_STATUSCODE_BADBROWSEDIRECTIONINVALID, "BadBrowseDirectionInvalid", "The browse direction is not valid."},
26527  {UA_STATUSCODE_BADNODENOTINVIEW, "BadNodeNotInView", "The node is not part of the view."},
26528  {UA_STATUSCODE_BADSERVERURIINVALID, "BadServerUriInvalid", "The ServerUri is not a valid URI."},
26529  {UA_STATUSCODE_BADSERVERNAMEMISSING, "BadServerNameMissing", "No ServerName was specified."},
26530  {UA_STATUSCODE_BADDISCOVERYURLMISSING, "BadDiscoveryUrlMissing", "No DiscoveryUrl was specified."},
26531  {UA_STATUSCODE_BADSEMPAHOREFILEMISSING, "BadSempahoreFileMissing", "The semaphore file specified by the client is not valid."},
26532  {UA_STATUSCODE_BADREQUESTTYPEINVALID, "BadRequestTypeInvalid", "The security token request type is not valid."},
26533  {UA_STATUSCODE_BADSECURITYMODEREJECTED, "BadSecurityModeRejected", "The security mode does not meet the requirements set by the Server."},
26534  {UA_STATUSCODE_BADSECURITYPOLICYREJECTED, "BadSecurityPolicyRejected", "The security policy does not meet the requirements set by the Server."},
26535  {UA_STATUSCODE_BADTOOMANYSESSIONS, "BadTooManySessions", "The server has reached its maximum number of sessions."},
26536  {UA_STATUSCODE_BADUSERSIGNATUREINVALID, "BadUserSignatureInvalid", "The user token signature is missing or invalid."},
26537  {UA_STATUSCODE_BADAPPLICATIONSIGNATUREINVALID, "BadApplicationSignatureInvalid", "The signature generated with the client certificate is missing or invalid."},
26538  {UA_STATUSCODE_BADNOVALIDCERTIFICATES, "BadNoValidCertificates", "The client did not provide at least one software certificate that is valid and meets the profile requirements for the server."},
26539  {UA_STATUSCODE_BADIDENTITYCHANGENOTSUPPORTED, "BadIdentityChangeNotSupported", "The Server does not support changing the user identity assigned to the session."},
26540  {UA_STATUSCODE_BADREQUESTCANCELLEDBYREQUEST, "BadRequestCancelledByRequest", "The request was cancelled by the client with the Cancel service."},
26541  {UA_STATUSCODE_BADPARENTNODEIDINVALID, "BadParentNodeIdInvalid", "The parent node id does not to refer to a valid node."},
26542  {UA_STATUSCODE_BADREFERENCENOTALLOWED, "BadReferenceNotAllowed", "The reference could not be created because it violates constraints imposed by the data model."},
26543  {UA_STATUSCODE_BADNODEIDREJECTED, "BadNodeIdRejected", "The requested node id was reject because it was either invalid or server does not allow node ids to be specified by the client."},
26544  {UA_STATUSCODE_BADNODEIDEXISTS, "BadNodeIdExists", "The requested node id is already used by another node."},
26545  {UA_STATUSCODE_BADNODECLASSINVALID, "BadNodeClassInvalid", "The node class is not valid."},
26546  {UA_STATUSCODE_BADBROWSENAMEINVALID, "BadBrowseNameInvalid", "The browse name is invalid."},
26547  {UA_STATUSCODE_BADBROWSENAMEDUPLICATED, "BadBrowseNameDuplicated", "The browse name is not unique among nodes that share the same relationship with the parent."},
26548  {UA_STATUSCODE_BADNODEATTRIBUTESINVALID, "BadNodeAttributesInvalid", "The node attributes are not valid for the node class."},
26549  {UA_STATUSCODE_BADTYPEDEFINITIONINVALID, "BadTypeDefinitionInvalid", "The type definition node id does not reference an appropriate type node."},
26550  {UA_STATUSCODE_BADSOURCENODEIDINVALID, "BadSourceNodeIdInvalid", "The source node id does not reference a valid node."},
26551  {UA_STATUSCODE_BADTARGETNODEIDINVALID, "BadTargetNodeIdInvalid", "The target node id does not reference a valid node."},
26552  {UA_STATUSCODE_BADDUPLICATEREFERENCENOTALLOWED, "BadDuplicateReferenceNotAllowed", "The reference type between the nodes is already defined."},
26553  {UA_STATUSCODE_BADINVALIDSELFREFERENCE, "BadInvalidSelfReference", "The server does not allow this type of self reference on this node."},
26554  {UA_STATUSCODE_BADREFERENCELOCALONLY, "BadReferenceLocalOnly", "The reference type is not valid for a reference to a remote server."},
26555  {UA_STATUSCODE_BADNODELETERIGHTS, "BadNoDeleteRights", "The server will not allow the node to be deleted."},
26556  {UA_STATUSCODE_UNCERTAINREFERENCENOTDELETED, "UncertainReferenceNotDeleted", "The server was not able to delete all target references."},
26557  {UA_STATUSCODE_BADSERVERINDEXINVALID, "BadServerIndexInvalid", "The server index is not valid."},
26558  {UA_STATUSCODE_BADVIEWIDUNKNOWN, "BadViewIdUnknown", "The view id does not refer to a valid view node."},
26559  {UA_STATUSCODE_BADVIEWTIMESTAMPINVALID, "BadViewTimestampInvalid", "The view timestamp is not available or not supported."},
26560  {UA_STATUSCODE_BADVIEWPARAMETERMISMATCH, "BadViewParameterMismatch", "The view parameters are not consistent with each other."},
26561  {UA_STATUSCODE_BADVIEWVERSIONINVALID, "BadViewVersionInvalid", "The view version is not available or not supported."},
26562  {UA_STATUSCODE_UNCERTAINNOTALLNODESAVAILABLE, "UncertainNotAllNodesAvailable", "The list of references may not be complete because the underlying system is not available."},
26563  {UA_STATUSCODE_GOODRESULTSMAYBEINCOMPLETE, "GoodResultsMayBeIncomplete", "The server should have followed a reference to a node in a remote server but did not. The result set may be incomplete."},
26564  {UA_STATUSCODE_BADNOTTYPEDEFINITION, "BadNotTypeDefinition", "The provided Nodeid was not a type definition nodeid."},
26565  {UA_STATUSCODE_UNCERTAINREFERENCEOUTOFSERVER, "UncertainReferenceOutOfServer", "One of the references to follow in the relative path references to a node in the address space in another server."},
26566  {UA_STATUSCODE_BADTOOMANYMATCHES, "BadTooManyMatches", "The requested operation has too many matches to return."},
26567  {UA_STATUSCODE_BADQUERYTOOCOMPLEX, "BadQueryTooComplex", "The requested operation requires too many resources in the server."},
26568  {UA_STATUSCODE_BADNOMATCH, "BadNoMatch", "The requested operation has no match to return."},
26569  {UA_STATUSCODE_BADMAXAGEINVALID, "BadMaxAgeInvalid", "The max age parameter is invalid."},
26570  {UA_STATUSCODE_BADSECURITYMODEINSUFFICIENT, "BadSecurityModeInsufficient", "The operation is not permitted over the current secure channel."},
26571  {UA_STATUSCODE_BADHISTORYOPERATIONINVALID, "BadHistoryOperationInvalid", "The history details parameter is not valid."},
26572  {UA_STATUSCODE_BADHISTORYOPERATIONUNSUPPORTED, "BadHistoryOperationUnsupported", "The server does not support the requested operation."},
26573  {UA_STATUSCODE_BADINVALIDTIMESTAMPARGUMENT, "BadInvalidTimestampArgument", "The defined timestamp to return was invalid."},
26574  {UA_STATUSCODE_BADWRITENOTSUPPORTED, "BadWriteNotSupported", "The server not does support writing the combination of value"},
26575  {UA_STATUSCODE_BADTYPEMISMATCH, "BadTypeMismatch", "The value supplied for the attribute is not of the same type as the attribute's value."},
26576  {UA_STATUSCODE_BADMETHODINVALID, "BadMethodInvalid", "The method id does not refer to a method for the specified object."},
26577  {UA_STATUSCODE_BADARGUMENTSMISSING, "BadArgumentsMissing", "The client did not specify all of the input arguments for the method."},
26578  {UA_STATUSCODE_BADTOOMANYSUBSCRIPTIONS, "BadTooManySubscriptions", "The server has reached its maximum number of subscriptions."},
26579  {UA_STATUSCODE_BADTOOMANYPUBLISHREQUESTS, "BadTooManyPublishRequests", "The server has reached the maximum number of queued publish requests."},
26580  {UA_STATUSCODE_BADNOSUBSCRIPTION, "BadNoSubscription", "There is no subscription available for this session."},
26581  {UA_STATUSCODE_BADSEQUENCENUMBERUNKNOWN, "BadSequenceNumberUnknown", "The sequence number is unknown to the server."},
26582  {UA_STATUSCODE_BADMESSAGENOTAVAILABLE, "BadMessageNotAvailable", "The requested notification message is no longer available."},
26583  {UA_STATUSCODE_BADINSUFFICIENTCLIENTPROFILE, "BadInsufficientClientProfile", "The Client of the current Session does not support one or more Profiles that are necessary for the Subscription."},
26584  {UA_STATUSCODE_BADSTATENOTACTIVE, "BadStateNotActive", "The sub-state machine is not currently active."},
26585  {UA_STATUSCODE_BADTCPSERVERTOOBUSY, "BadTcpServerTooBusy", "The server cannot process the request because it is too busy."},
26586  {UA_STATUSCODE_BADTCPMESSAGETYPEINVALID, "BadTcpMessageTypeInvalid", "The type of the message specified in the header invalid."},
26587  {UA_STATUSCODE_BADTCPSECURECHANNELUNKNOWN, "BadTcpSecureChannelUnknown", "The SecureChannelId and/or TokenId are not currently in use."},
26588  {UA_STATUSCODE_BADTCPMESSAGETOOLARGE, "BadTcpMessageTooLarge", "The size of the message specified in the header is too large."},
26589  {UA_STATUSCODE_BADTCPNOTENOUGHRESOURCES, "BadTcpNotEnoughResources", "There are not enough resources to process the request."},
26590  {UA_STATUSCODE_BADTCPINTERNALERROR, "BadTcpInternalError", "An internal error occurred."},
26591  {UA_STATUSCODE_BADTCPENDPOINTURLINVALID, "BadTcpEndpointUrlInvalid", "The Server does not recognize the QueryString specified."},
26592  {UA_STATUSCODE_BADREQUESTINTERRUPTED, "BadRequestInterrupted", "The request could not be sent because of a network interruption."},
26593  {UA_STATUSCODE_BADREQUESTTIMEOUT, "BadRequestTimeout", "Timeout occurred while processing the request."},
26594  {UA_STATUSCODE_BADSECURECHANNELCLOSED, "BadSecureChannelClosed", "The secure channel has been closed."},
26595  {UA_STATUSCODE_BADSECURECHANNELTOKENUNKNOWN, "BadSecureChannelTokenUnknown", "The token has expired or is not recognized."},
26596  {UA_STATUSCODE_BADSEQUENCENUMBERINVALID, "BadSequenceNumberInvalid", "The sequence number is not valid."},
26597  {UA_STATUSCODE_BADPROTOCOLVERSIONUNSUPPORTED, "BadProtocolVersionUnsupported", "The applications do not have compatible protocol versions."},
26598  {UA_STATUSCODE_BADCONFIGURATIONERROR, "BadConfigurationError", "There is a problem with the configuration that affects the usefulness of the value."},
26599  {UA_STATUSCODE_BADNOTCONNECTED, "BadNotConnected", "The variable should receive its value from another variable"},
26600  {UA_STATUSCODE_BADDEVICEFAILURE, "BadDeviceFailure", "There has been a failure in the device/data source that generates the value that has affected the value."},
26601  {UA_STATUSCODE_BADSENSORFAILURE, "BadSensorFailure", "There has been a failure in the sensor from which the value is derived by the device/data source."},
26602  {UA_STATUSCODE_BADOUTOFSERVICE, "BadOutOfService", "The source of the data is not operational."},
26603  {UA_STATUSCODE_BADDEADBANDFILTERINVALID, "BadDeadbandFilterInvalid", "The deadband filter is not valid."},
26604  {UA_STATUSCODE_UNCERTAINNOCOMMUNICATIONLASTUSABLEVALUE, "UncertainNoCommunicationLastUsableValue", "Communication to the data source has failed. The variable value is the last value that had a good quality."},
26605  {UA_STATUSCODE_UNCERTAINLASTUSABLEVALUE, "UncertainLastUsableValue", "Whatever was updating this value has stopped doing so."},
26606  {UA_STATUSCODE_UNCERTAINSUBSTITUTEVALUE, "UncertainSubstituteValue", "The value is an operational value that was manually overwritten."},
26607  {UA_STATUSCODE_UNCERTAININITIALVALUE, "UncertainInitialValue", "The value is an initial value for a variable that normally receives its value from another variable."},
26608  {UA_STATUSCODE_UNCERTAINSENSORNOTACCURATE, "UncertainSensorNotAccurate", "The value is at one of the sensor limits."},
26609  {UA_STATUSCODE_UNCERTAINENGINEERINGUNITSEXCEEDED, "UncertainEngineeringUnitsExceeded", "The value is outside of the range of values defined for this parameter."},
26610  {UA_STATUSCODE_UNCERTAINSUBNORMAL, "UncertainSubNormal", "The value is derived from multiple sources and has less than the required number of Good sources."},
26611  {UA_STATUSCODE_GOODLOCALOVERRIDE, "GoodLocalOverride", "The value has been overridden."},
26612  {UA_STATUSCODE_BADREFRESHINPROGRESS, "BadRefreshInProgress", "This Condition refresh failed"},
26613  {UA_STATUSCODE_BADCONDITIONALREADYDISABLED, "BadConditionAlreadyDisabled", "This condition has already been disabled."},
26614  {UA_STATUSCODE_BADCONDITIONALREADYENABLED, "BadConditionAlreadyEnabled", "This condition has already been enabled."},
26615  {UA_STATUSCODE_BADCONDITIONDISABLED, "BadConditionDisabled", "Property not available"},
26616  {UA_STATUSCODE_BADEVENTIDUNKNOWN, "BadEventIdUnknown", "The specified event id is not recognized."},
26617  {UA_STATUSCODE_BADEVENTNOTACKNOWLEDGEABLE, "BadEventNotAcknowledgeable", "The event cannot be acknowledged."},
26618  {UA_STATUSCODE_BADDIALOGNOTACTIVE, "BadDialogNotActive", "The dialog condition is not active."},
26619  {UA_STATUSCODE_BADDIALOGRESPONSEINVALID, "BadDialogResponseInvalid", "The response is not valid for the dialog."},
26620  {UA_STATUSCODE_BADCONDITIONBRANCHALREADYACKED, "BadConditionBranchAlreadyAcked", "The condition branch has already been acknowledged."},
26621  {UA_STATUSCODE_BADCONDITIONBRANCHALREADYCONFIRMED, "BadConditionBranchAlreadyConfirmed", "The condition branch has already been confirmed."},
26622  {UA_STATUSCODE_BADCONDITIONALREADYSHELVED, "BadConditionAlreadyShelved", "The condition has already been shelved."},
26623  {UA_STATUSCODE_BADCONDITIONNOTSHELVED, "BadConditionNotShelved", "The condition is not currently shelved."},
26624  {UA_STATUSCODE_BADSHELVINGTIMEOUTOFRANGE, "BadShelvingTimeOutOfRange", "The shelving time not within an acceptable range."},
26625  {UA_STATUSCODE_BADNODATA, "BadNoData", "No data exists for the requested time range or event filter."},
26626  {UA_STATUSCODE_BADBOUNDNOTFOUND, "BadBoundNotFound", "No data found to provide upper or lower bound value."},
26627  {UA_STATUSCODE_BADBOUNDNOTSUPPORTED, "BadBoundNotSupported", "The server cannot retrieve a bound for the variable."},
26628  {UA_STATUSCODE_BADDATALOST, "BadDataLost", "Data is missing due to collection started/stopped/lost."},
26629  {UA_STATUSCODE_BADDATAUNAVAILABLE, "BadDataUnavailable", "Expected data is unavailable for the requested time range due to an un-mounted volume"},
26630  {UA_STATUSCODE_BADENTRYEXISTS, "BadEntryExists", "The data or event was not successfully inserted because a matching entry exists."},
26631  {UA_STATUSCODE_BADNOENTRYEXISTS, "BadNoEntryExists", "The data or event was not successfully updated because no matching entry exists."},
26632  {UA_STATUSCODE_BADTIMESTAMPNOTSUPPORTED, "BadTimestampNotSupported", "The client requested history using a timestamp format the server does not support (i.e requested ServerTimestamp when server only supports SourceTimestamp)."},
26633  {UA_STATUSCODE_GOODENTRYINSERTED, "GoodEntryInserted", "The data or event was successfully inserted into the historical database."},
26634  {UA_STATUSCODE_GOODENTRYREPLACED, "GoodEntryReplaced", "The data or event field was successfully replaced in the historical database."},
26635  {UA_STATUSCODE_UNCERTAINDATASUBNORMAL, "UncertainDataSubNormal", "The value is derived from multiple values and has less than the required number of Good values."},
26636  {UA_STATUSCODE_GOODNODATA, "GoodNoData", "No data exists for the requested time range or event filter."},
26637  {UA_STATUSCODE_GOODMOREDATA, "GoodMoreData", "The data or event field was successfully replaced in the historical database."},
26638  {UA_STATUSCODE_BADAGGREGATELISTMISMATCH, "BadAggregateListMismatch", "The requested number of Aggregates does not match the requested number of NodeIds."},
26639  {UA_STATUSCODE_BADAGGREGATENOTSUPPORTED, "BadAggregateNotSupported", "The requested Aggregate is not support by the server."},
26640  {UA_STATUSCODE_BADAGGREGATEINVALIDINPUTS, "BadAggregateInvalidInputs", "The aggregate value could not be derived due to invalid data inputs."},
26641  {UA_STATUSCODE_BADAGGREGATECONFIGURATIONREJECTED, "BadAggregateConfigurationRejected", "The aggregate configuration is not valid for specified node."},
26642  {UA_STATUSCODE_GOODDATAIGNORED, "GoodDataIgnored", "The request pecifies fields which are not valid for the EventType or cannot be saved by the historian."},
26643  {UA_STATUSCODE_BADREQUESTNOTALLOWED, "BadRequestNotAllowed", "The request was rejected by the server because it did not meet the criteria set by the server."},
26644  {UA_STATUSCODE_GOODEDITED, "GoodEdited", "The value does not come from the real source and has been edited by the server."},
26645  {UA_STATUSCODE_GOODPOSTACTIONFAILED, "GoodPostActionFailed", "There was an error in execution of these post-actions."},
26646  {UA_STATUSCODE_UNCERTAINDOMINANTVALUECHANGED, "UncertainDominantValueChanged", "The related EngineeringUnit has been changed but the Variable Value is still provided based on the previous unit."},
26647  {UA_STATUSCODE_GOODDEPENDENTVALUECHANGED, "GoodDependentValueChanged", "A dependent value has been changed but the change has not been applied to the device."},
26648  {UA_STATUSCODE_BADDOMINANTVALUECHANGED, "BadDominantValueChanged", "The related EngineeringUnit has been changed but this change has not been applied to the device. The Variable Value is still dependent on the previous unit but its status is currently Bad."},
26649  {UA_STATUSCODE_UNCERTAINDEPENDENTVALUECHANGED, "UncertainDependentValueChanged", "A dependent value has been changed but the change has not been applied to the device. The quality of the dominant variable is uncertain."},
26650  {UA_STATUSCODE_BADDEPENDENTVALUECHANGED, "BadDependentValueChanged", "A dependent value has been changed but the change has not been applied to the device. The quality of the dominant variable is Bad."},
26651  {UA_STATUSCODE_GOODCOMMUNICATIONEVENT, "GoodCommunicationEvent", "The communication layer has raised an event."},
26652  {UA_STATUSCODE_GOODSHUTDOWNEVENT, "GoodShutdownEvent", "The system is shutting down."},
26653  {UA_STATUSCODE_GOODCALLAGAIN, "GoodCallAgain", "The operation is not finished and needs to be called again."},
26654  {UA_STATUSCODE_GOODNONCRITICALTIMEOUT, "GoodNonCriticalTimeout", "A non-critical timeout occurred."},
26655  {UA_STATUSCODE_BADINVALIDARGUMENT, "BadInvalidArgument", "One or more arguments are invalid."},
26656  {UA_STATUSCODE_BADCONNECTIONREJECTED, "BadConnectionRejected", "Could not establish a network connection to remote server."},
26657  {UA_STATUSCODE_BADDISCONNECT, "BadDisconnect", "The server has disconnected from the client."},
26658  {UA_STATUSCODE_BADCONNECTIONCLOSED, "BadConnectionClosed", "The network connection has been closed."},
26659  {UA_STATUSCODE_BADINVALIDSTATE, "BadInvalidState", "The operation cannot be completed because the object is closed"},
26660  {UA_STATUSCODE_BADENDOFSTREAM, "BadEndOfStream", "Cannot move beyond end of the stream."},
26661  {UA_STATUSCODE_BADNODATAAVAILABLE, "BadNoDataAvailable", "No data is currently available for reading from a non-blocking stream."},
26662  {UA_STATUSCODE_BADWAITINGFORRESPONSE, "BadWaitingForResponse", "The asynchronous operation is waiting for a response."},
26663  {UA_STATUSCODE_BADOPERATIONABANDONED, "BadOperationAbandoned", "The asynchronous operation was abandoned by the caller."},
26664  {UA_STATUSCODE_BADEXPECTEDSTREAMTOBLOCK, "BadExpectedStreamToBlock", "The stream did not return all data requested (possibly because it is a non-blocking stream)."},
26665  {UA_STATUSCODE_BADWOULDBLOCK, "BadWouldBlock", "Non blocking behaviour is required and the operation would block."},
26666  {UA_STATUSCODE_BADSYNTAXERROR, "BadSyntaxError", "A value had an invalid syntax."},
26667  {UA_STATUSCODE_BADMAXCONNECTIONSREACHED, "BadMaxConnectionsReached", "The operation could not be finished because all available connections are in use."},
26668  {0xffffffff, "Unknown", "Unknown StatusCode"},
26669 };
26670 #endif
26671 
26674  for(size_t i = 0; i < statusCodeDescriptionsSize; ++i) {
26675  if(statusCodeDescriptions[i].code == code)
26676  return &statusCodeDescriptions[i];
26677  }
26678  return &statusCodeDescriptions[statusCodeDescriptionsSize-1];
26679 }
26680 
26681 
26682 /*********************************** amalgamated original file "/home/iosb/sw/open62541/plugins/ua_network_tcp.c" ***********************************/
26683 
26684 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
26685  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
26686 
26687 #if defined(__MINGW32__) && (!defined(WINVER) || WINVER < 0x501)
26688 /* Assume the target is newer than Windows XP */
26689 # undef WINVER
26690 # undef _WIN32_WINDOWS
26691 # undef _WIN32_WINNT
26692 # define WINVER 0x0501
26693 # define _WIN32_WINDOWS 0x0501
26694 # define _WIN32_WINNT 0x0501
26695 #endif
26696 
26697 
26698 #include <stdlib.h> // malloc, free
26699 #include <stdio.h> // snprintf
26700 #include <string.h> // memset
26701 #include <errno.h>
26702 #ifdef _WIN32
26703 # ifndef __clang__
26704 # include <malloc.h>
26705 # endif
26706 /* Fix redefinition of SLIST_ENTRY on mingw winnt.h */
26707 # ifdef SLIST_ENTRY
26708 # undef SLIST_ENTRY
26709 # endif
26710 /* inet_ntoa is deprecated on MSVC but used for compatibility */
26711 # define _WINSOCK_DEPRECATED_NO_WARNINGS
26712 # include <winsock2.h>
26713 # include <ws2tcpip.h>
26714 # define CLOSESOCKET(S) closesocket((SOCKET)S)
26715 # define ssize_t int
26716 # define WIN32_INT (int)
26717 #else
26718 # define CLOSESOCKET(S) close(S)
26719 # define SOCKET int
26720 # define WIN32_INT
26721 # include <arpa/inet.h>
26722 # include <netinet/in.h>
26723 # include <sys/select.h>
26724 # include <sys/ioctl.h>
26725 # include <fcntl.h>
26726 # include <unistd.h> // read, write, close
26727 # include <netdb.h>
26728 # ifdef __QNX__
26729 # include <sys/socket.h>
26730 # endif
26731 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
26732 # include <sys/param.h>
26733 # if defined(BSD)
26734 # include<sys/socket.h>
26735 # endif
26736 #endif
26737 # ifndef __CYGWIN__
26738 # include <netinet/tcp.h>
26739 # endif
26740 #endif
26741 
26742 /* unsigned int for windows and workaround to a glibc bug */
26743 /* Additionally if GNU_LIBRARY is not defined, it may be using musl libc (e.g. Docker Alpine) */
26744 #if defined(_WIN32) || defined(__OpenBSD__) || \
26745  (defined(__GNU_LIBRARY__) && (__GNU_LIBRARY__ <= 6) && \
26746  (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 16) || \
26747  !defined(__GNU_LIBRARY__))
26748 # define UA_fd_set(fd, fds) FD_SET((unsigned int)fd, fds)
26749 # define UA_fd_isset(fd, fds) FD_ISSET((unsigned int)fd, fds)
26750 #else
26751 # define UA_fd_set(fd, fds) FD_SET(fd, fds)
26752 # define UA_fd_isset(fd, fds) FD_ISSET(fd, fds)
26753 #endif
26754 
26755 #ifdef UA_ENABLE_MULTITHREADING
26756 # include <urcu/uatomic.h>
26757 #endif
26758 
26759 #ifdef _WIN32
26760 #define errno__ WSAGetLastError()
26761 # define INTERRUPTED WSAEINTR
26762 # define WOULDBLOCK WSAEWOULDBLOCK
26763 # define AGAIN WSAEWOULDBLOCK
26764 #else
26765 # define errno__ errno
26766 # define INTERRUPTED EINTR
26767 # define WOULDBLOCK EWOULDBLOCK
26768 # define AGAIN EAGAIN
26769 #endif
26770 
26771 /****************************/
26772 /* Generic Socket Functions */
26773 /****************************/
26774 
26775 static void
26776 socket_close(UA_Connection *connection) {
26777  connection->state = UA_CONNECTION_CLOSED;
26778  shutdown((SOCKET)connection->sockfd,2);
26779  CLOSESOCKET(connection->sockfd);
26780 }
26781 
26782 static UA_StatusCode
26783 socket_write(UA_Connection *connection, UA_ByteString *buf) {
26784  size_t nWritten = 0;
26785  int flags = 0;
26786 #ifdef MSG_NOSIGNAL
26787  flags = MSG_NOSIGNAL;
26788 #endif
26789  do {
26790  ssize_t n = 0;
26791  do {
26792  /* If the OS throws EMSGSIZE, force a smaller packet size:
26793  * size_t bytes_to_send = buf->length - nWritten > 1024 ? 1024 : buf->length - nWritten; */
26794  size_t bytes_to_send = buf->length - nWritten;
26795  n = send((SOCKET)connection->sockfd, (const char*)buf->data + nWritten,
26796  WIN32_INT bytes_to_send, flags);
26797  if(n < 0 && errno__ != INTERRUPTED && errno__ != AGAIN) {
26798  connection->close(connection);
26799  socket_close(connection);
26800  UA_ByteString_deleteMembers(buf);
26802  }
26803  } while(n < 0);
26804  nWritten += (size_t)n;
26805  } while(nWritten < buf->length);
26806  UA_ByteString_deleteMembers(buf);
26807  return UA_STATUSCODE_GOOD;
26808 }
26809 
26810 static UA_StatusCode
26811 socket_recv(UA_Connection *connection, UA_ByteString *response, UA_UInt32 timeout) {
26812  response->data = malloc(connection->localConf.recvBufferSize);
26813  if(!response->data) {
26814  response->length = 0;
26815  return UA_STATUSCODE_BADOUTOFMEMORY; /* not enough memory retry */
26816  }
26817 
26818  if(timeout > 0) {
26819  /* currently, only the client uses timeouts */
26820 #ifndef _WIN32
26821  UA_UInt32 timeout_usec = timeout * 1000;
26822 # ifdef __APPLE__
26823  struct timeval tmptv = {(long int)(timeout_usec / 1000000), timeout_usec % 1000000};
26824 # else
26825  struct timeval tmptv = {(long int)(timeout_usec / 1000000), (long int)(timeout_usec % 1000000)};
26826 # endif
26827  int ret = setsockopt(connection->sockfd, SOL_SOCKET, SO_RCVTIMEO,
26828  (const char *)&tmptv, sizeof(struct timeval));
26829 #else
26830  DWORD timeout_dw = timeout;
26831  int ret = setsockopt(connection->sockfd, SOL_SOCKET, SO_RCVTIMEO,
26832  (const char*)&timeout_dw, sizeof(DWORD));
26833 #endif
26834  if(0 != ret) {
26835  UA_ByteString_deleteMembers(response);
26836  socket_close(connection);
26838  }
26839  }
26840 
26841 #ifdef __CYGWIN__
26842  /* Workaround for https://cygwin.com/ml/cygwin/2013-07/msg00107.html */
26843  ssize_t ret;
26844  if(timeout > 0) {
26845  fd_set fdset;
26846  FD_ZERO(&fdset);
26847  UA_fd_set(connection->sockfd, &fdset);
26848  UA_UInt32 timeout_usec = timeout * 1000;
26849  struct timeval tmptv = {(long int)(timeout_usec / 1000000),
26850  (long int)(timeout_usec % 1000000)};
26851  int retval = select(connection->sockfd+1, &fdset, NULL, NULL, &tmptv);
26852  if(retval && UA_fd_isset(connection->sockfd, &fdset)) {
26853  ret = recv(connection->sockfd, (char*)response->data,
26854  connection->localConf.recvBufferSize, 0);
26855  } else {
26856  ret = 0;
26857  }
26858  } else {
26859  ret = recv(connection->sockfd, (char*)response->data,
26860  connection->localConf.recvBufferSize, 0);
26861  }
26862 #else
26863  ssize_t ret = recv(connection->sockfd, (char*)response->data,
26864  connection->localConf.recvBufferSize, 0);
26865 #endif
26866 
26867  /* server has closed the connection */
26868  if(ret == 0) {
26869  UA_ByteString_deleteMembers(response);
26870  socket_close(connection);
26872  }
26873 
26874  /* error case */
26875  if(ret < 0) {
26876  UA_ByteString_deleteMembers(response);
26877  if(errno__ == INTERRUPTED || (timeout > 0) ?
26878  false : (errno__ == EAGAIN || errno__ == WOULDBLOCK))
26879  return UA_STATUSCODE_GOOD; /* statuscode_good but no data -> retry */
26880  socket_close(connection);
26882  }
26883 
26884  /* default case */
26885  response->length = (size_t)ret;
26886  return UA_STATUSCODE_GOOD;
26887 }
26888 
26889 static UA_StatusCode socket_set_nonblocking(SOCKET sockfd) {
26890 #ifdef _WIN32
26891  u_long iMode = 1;
26892  if(ioctlsocket(sockfd, FIONBIO, &iMode) != NO_ERROR)
26894 #else
26895  int opts = fcntl(sockfd, F_GETFL);
26896  if(opts < 0 || fcntl(sockfd, F_SETFL, opts|O_NONBLOCK) < 0)
26898 #endif
26899  return UA_STATUSCODE_GOOD;
26900 }
26901 
26902 static void FreeConnectionCallback(UA_Server *server, void *ptr) {
26904  free(ptr);
26905  }
26906 
26907 /***************************/
26908 /* Server NetworkLayer TCP */
26909 /***************************/
26910 
26944 #define MAXBACKLOG 100
26945 
26946 typedef struct {
26949  UA_Logger logger; // Set during start
26950 
26951  /* open sockets and connections */
26957  } *mappings;
26959 
26960 static UA_StatusCode
26961 ServerNetworkLayerGetSendBuffer(UA_Connection *connection, size_t length, UA_ByteString *buf) {
26962  if(length > connection->remoteConf.recvBufferSize)
26964  return UA_ByteString_allocBuffer(buf, length);
26965 }
26966 
26967 static void
26968 ServerNetworkLayerReleaseSendBuffer(UA_Connection *connection, UA_ByteString *buf) {
26969  UA_ByteString_deleteMembers(buf);
26970 }
26971 
26972 static void
26973 ServerNetworkLayerReleaseRecvBuffer(UA_Connection *connection, UA_ByteString *buf) {
26974  UA_ByteString_deleteMembers(buf);
26975 }
26976 
26977 /* after every select, we need to reset the sockets we want to listen on */
26978 static UA_Int32
26979 setFDSet(ServerNetworkLayerTCP *layer, fd_set *fdset) {
26980  FD_ZERO(fdset);
26981  UA_fd_set(layer->serversockfd, fdset);
26982  UA_Int32 highestfd = layer->serversockfd;
26983  for(size_t i = 0; i < layer->mappingsSize; ++i) {
26984  UA_fd_set(layer->mappings[i].sockfd, fdset);
26985  if(layer->mappings[i].sockfd > highestfd)
26986  highestfd = layer->mappings[i].sockfd;
26987  }
26988  return highestfd;
26989 }
26990 
26991 /* callback triggered from the server */
26992 static void
26993 ServerNetworkLayerTCP_closeConnection(UA_Connection *connection) {
26994 #ifdef UA_ENABLE_MULTITHREADING
26995  if(uatomic_xchg(&connection->state, UA_CONNECTION_CLOSED) == UA_CONNECTION_CLOSED)
26996  return;
26997 #else
26998  if(connection->state == UA_CONNECTION_CLOSED)
26999  return;
27000  connection->state = UA_CONNECTION_CLOSED;
27001 #endif
27002 #if UA_LOGLEVEL <= 300
27003  //cppcheck-suppress unreadVariable
27004  ServerNetworkLayerTCP *layer = connection->handle;
27005  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27006  "Connection %i | Force closing the connection",
27007  connection->sockfd);
27008 #endif
27009  /* only "shutdown" here. this triggers the select, where the socket is
27010  "closed" in the mainloop */
27011  shutdown(connection->sockfd, 2);
27012 }
27013 
27014 /* call only from the single networking thread */
27015 static UA_StatusCode
27016 ServerNetworkLayerTCP_add(ServerNetworkLayerTCP *layer, UA_Int32 newsockfd) {
27017  UA_Connection *c = malloc(sizeof(UA_Connection));
27018  if(!c)
27020 
27021  struct sockaddr_in addr;
27022  socklen_t addrlen = sizeof(struct sockaddr_in);
27023  int res = getpeername(newsockfd, (struct sockaddr*)&addr, &addrlen);
27024 
27025  if(res == 0) {
27026  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27027  "Connection %i | New connection over TCP from %s:%d",
27028  newsockfd, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
27029  } else {
27030  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27031  "Connection %i | New connection over TCP, "
27032  "getpeername failed with errno %i", newsockfd, errno);
27033  }
27034 
27035  memset(c, 0, sizeof(UA_Connection));
27036  c->sockfd = newsockfd;
27037  c->handle = layer;
27038  c->localConf = layer->conf;
27039  c->remoteConf = layer->conf;
27040  c->send = socket_write;
27041  c->close = ServerNetworkLayerTCP_closeConnection;
27042  c->getSendBuffer = ServerNetworkLayerGetSendBuffer;
27043  c->releaseSendBuffer = ServerNetworkLayerReleaseSendBuffer;
27044  c->releaseRecvBuffer = ServerNetworkLayerReleaseRecvBuffer;
27046  struct ConnectionMapping *nm;
27047  nm = realloc(layer->mappings,
27048  sizeof(struct ConnectionMapping)*(layer->mappingsSize+1));
27049  if(!nm) {
27050  UA_LOG_ERROR(layer->logger, UA_LOGCATEGORY_NETWORK,
27051  "No memory for a new Connection");
27052  free(c);
27054  }
27055  layer->mappings = nm;
27056  layer->mappings[layer->mappingsSize].connection = c;
27057  layer->mappings[layer->mappingsSize].sockfd = newsockfd;
27058  ++layer->mappingsSize;
27059  return UA_STATUSCODE_GOOD;
27060 }
27061 
27062 static UA_StatusCode
27063 ServerNetworkLayerTCP_start(UA_ServerNetworkLayer *nl, UA_Logger logger) {
27064  ServerNetworkLayerTCP *layer = nl->handle;
27065  layer->logger = logger;
27066 
27067  /* get the discovery url from the hostname */
27069  char hostname[256];
27070  if(gethostname(hostname, 255) == 0) {
27071  char discoveryUrl[256];
27072 #ifndef _MSC_VER
27073  du.length = (size_t)snprintf(discoveryUrl, 255, "opc.tcp://%s:%d",
27074  hostname, layer->port);
27075 #else
27076  du.length = (size_t)_snprintf_s(discoveryUrl, 255, _TRUNCATE,
27077  "opc.tcp://%s:%d", hostname, layer->port);
27078 #endif
27079  du.data = (UA_Byte*)discoveryUrl;
27080  }
27081  UA_String_copy(&du, &nl->discoveryUrl);
27082 
27083  /* Create the server socket */
27084  SOCKET newsock = socket(PF_INET, SOCK_STREAM, 0);
27085 #ifdef _WIN32
27086  if(newsock == INVALID_SOCKET)
27087 #else
27088  if(newsock < 0)
27089 #endif
27090  {
27091  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27092  "Error opening the server socket");
27094  }
27095 
27096  /* Set socket options */
27097  int optval = 1;
27098  if(setsockopt(newsock, SOL_SOCKET, SO_REUSEADDR,
27099  (const char *)&optval, sizeof(optval)) == -1 ||
27100  socket_set_nonblocking(newsock) != UA_STATUSCODE_GOOD) {
27101  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27102  "Error during setting of server socket options");
27103  CLOSESOCKET(newsock);
27105  }
27106 
27107  /* Bind socket to address */
27108  const struct sockaddr_in serv_addr = {
27109  .sin_family = AF_INET, .sin_addr.s_addr = INADDR_ANY,
27110  .sin_port = htons(layer->port), .sin_zero = {0}};
27111  if(bind(newsock, (const struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
27112  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27113  "Error during binding of the server socket");
27114  CLOSESOCKET(newsock);
27116  }
27117 
27118  /* Start listening */
27119  if(listen(newsock, MAXBACKLOG) < 0) {
27120  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27121  "Error listening on server socket");
27122  CLOSESOCKET(newsock);
27124  }
27125 
27126  layer->serversockfd = (UA_Int32)newsock; /* cast on win32 */
27127  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27128  "TCP network layer listening on %.*s",
27130  return UA_STATUSCODE_GOOD;
27131 }
27132 
27133 static size_t
27134 removeClosedConnections(ServerNetworkLayerTCP *layer, UA_Job *js) {
27135  size_t c = 0;
27136  for(size_t i = 0; i < layer->mappingsSize; ++i) {
27137  if(layer->mappings[i].connection &&
27139  continue;
27140  /* the socket was closed from remote */
27141  UA_Connection *conn = layer->mappings[i].connection;
27142  js[c].type = UA_JOBTYPE_DETACHCONNECTION;
27143  js[c].job.closeConnection = conn;
27144  layer->mappings[i] = layer->mappings[layer->mappingsSize-1];
27145  --layer->mappingsSize;
27146  ++c;
27147  js[c].type = UA_JOBTYPE_METHODCALL_DELAYED;
27148  js[c].job.methodCall.method = FreeConnectionCallback;
27149  js[c].job.methodCall.data = conn;
27150  ++c;
27151  }
27152  return c;
27153 }
27154 
27155 static size_t
27156 ServerNetworkLayerTCP_getJobs(UA_ServerNetworkLayer *nl, UA_Job **jobs,
27157  UA_UInt16 timeout) {
27158  /* Every open socket can generate two jobs */
27159  ServerNetworkLayerTCP *layer = nl->handle;
27160  UA_Job *js = malloc(sizeof(UA_Job) * (size_t)((layer->mappingsSize * 2)));
27161  if(!js)
27163 
27164  /* Remove closed sockets */
27165  size_t totalJobs = removeClosedConnections(layer, js);
27166 
27167  /* Listen on open sockets (including the server) */
27168  fd_set fdset, errset;
27169  UA_Int32 highestfd = setFDSet(layer, &fdset);
27170  setFDSet(layer, &errset);
27171  struct timeval tmptv = {0, timeout * 1000};
27172  UA_Int32 resultsize = select(highestfd+1, &fdset, NULL, &errset, &tmptv);
27173  if(totalJobs == 0 && resultsize <= 0) {
27174  free(js);
27175  *jobs = NULL;
27176  return 0;
27177  }
27178 
27179  /* Accept new connection via the server socket (can only be a single one) */
27180  if(UA_fd_isset(layer->serversockfd, &fdset)) {
27181  --resultsize;
27182  SOCKET newsockfd = accept((SOCKET)layer->serversockfd, NULL, NULL);
27183 #ifdef _WIN32
27184  if(newsockfd != INVALID_SOCKET)
27185 #else
27186  if(newsockfd >= 0)
27187 #endif
27188  {
27189  socket_set_nonblocking(newsockfd);
27190  /* Do not merge packets on the socket (disable Nagle's algorithm) */
27191  int i = 1;
27192  setsockopt(newsockfd, IPPROTO_TCP, TCP_NODELAY, (void *)&i, sizeof(i));
27193  ServerNetworkLayerTCP_add(layer, (UA_Int32)newsockfd);
27194  }
27195  }
27196 
27197  /* Read from established sockets */
27199  size_t j = 0;
27200  for(size_t i = 0; i < layer->mappingsSize && j < (size_t)resultsize; ++i) {
27201  if(!UA_fd_isset(layer->mappings[i].sockfd, &errset) &&
27202  !UA_fd_isset(layer->mappings[i].sockfd, &fdset))
27203  continue;
27204 
27205  UA_StatusCode retval = socket_recv(layer->mappings[i].connection, &buf, 0);
27206  if(retval == UA_STATUSCODE_GOOD) {
27207  js[totalJobs + j].job.binaryMessage.connection = layer->mappings[i].connection;
27208  js[totalJobs + j].job.binaryMessage.message = buf;
27209  js[totalJobs + j].type = UA_JOBTYPE_BINARYMESSAGE_NETWORKLAYER;
27210  ++j;
27211  } else if (retval == UA_STATUSCODE_BADCONNECTIONCLOSED) {
27212  UA_Connection *c = layer->mappings[i].connection;
27213  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27214  "Connection %i | Connection closed from remote", c->sockfd);
27215  /* the socket was closed from remote */
27216  js[totalJobs + j].type = UA_JOBTYPE_DETACHCONNECTION;
27217  js[totalJobs + j].job.closeConnection = c;
27218  layer->mappings[i] = layer->mappings[layer->mappingsSize-1];
27219  --layer->mappingsSize;
27220  ++totalJobs; /* increase j only once */
27221  js[totalJobs + j].type = UA_JOBTYPE_METHODCALL_DELAYED;
27222  js[totalJobs + j].job.methodCall.method = FreeConnectionCallback;
27223  js[totalJobs + j].job.methodCall.data = c;
27224  ++j;
27225  }
27226  }
27227  totalJobs += j;
27228 
27229  if(totalJobs == 0) {
27230  free(js);
27231  js = NULL;
27232  }
27233  *jobs = js;
27234  return totalJobs;
27235 }
27236 
27237 static size_t
27238 ServerNetworkLayerTCP_stop(UA_ServerNetworkLayer *nl, UA_Job **jobs) {
27239  ServerNetworkLayerTCP *layer = nl->handle;
27240  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27241  "Shutting down the TCP network layer with %d open connection(s)",
27242  layer->mappingsSize);
27243  shutdown((SOCKET)layer->serversockfd,2);
27244  CLOSESOCKET(layer->serversockfd);
27245  UA_Job *items = malloc(sizeof(UA_Job) * layer->mappingsSize * 2);
27246  if(!items)
27247  return 0;
27248  for(size_t i = 0; i < layer->mappingsSize; ++i) {
27249  socket_close(layer->mappings[i].connection);
27250  items[i*2].type = UA_JOBTYPE_DETACHCONNECTION;
27251  items[i*2].job.closeConnection = layer->mappings[i].connection;
27252  items[(i*2)+1].type = UA_JOBTYPE_METHODCALL_DELAYED;
27253  items[(i*2)+1].job.methodCall.method = FreeConnectionCallback;
27254  items[(i*2)+1].job.methodCall.data = layer->mappings[i].connection;
27255  }
27256 #ifdef _WIN32
27257  WSACleanup();
27258 #endif
27259  *jobs = items;
27260  return layer->mappingsSize*2;
27261 }
27262 
27263 /* run only when the server is stopped */
27264 static void ServerNetworkLayerTCP_deleteMembers(UA_ServerNetworkLayer *nl) {
27265  ServerNetworkLayerTCP *layer = nl->handle;
27266  free(layer->mappings);
27267  free(layer);
27268  UA_String_deleteMembers(&nl->discoveryUrl);
27269 }
27270 
27273 #ifdef _WIN32
27274  WORD wVersionRequested;
27275  WSADATA wsaData;
27276  wVersionRequested = MAKEWORD(2, 2);
27277  WSAStartup(wVersionRequested, &wsaData);
27278 #endif
27279 
27281  memset(&nl, 0, sizeof(UA_ServerNetworkLayer));
27282  ServerNetworkLayerTCP *layer = calloc(1,sizeof(ServerNetworkLayerTCP));
27283  if(!layer)
27284  return nl;
27285 
27286  layer->conf = conf;
27287  layer->port = port;
27288 
27289  nl.handle = layer;
27290  nl.start = ServerNetworkLayerTCP_start;
27291  nl.getJobs = ServerNetworkLayerTCP_getJobs;
27292  nl.stop = ServerNetworkLayerTCP_stop;
27293  nl.deleteMembers = ServerNetworkLayerTCP_deleteMembers;
27294  return nl;
27295 }
27296 
27297 /***************************/
27298 /* Client NetworkLayer TCP */
27299 /***************************/
27300 
27301 static UA_StatusCode
27302 ClientNetworkLayerGetBuffer(UA_Connection *connection, size_t length,
27303  UA_ByteString *buf) {
27304  if(length > connection->remoteConf.recvBufferSize)
27306  if(connection->state == UA_CONNECTION_CLOSED)
27308  return UA_ByteString_allocBuffer(buf, connection->remoteConf.recvBufferSize);
27309 }
27310 
27311 static void
27312 ClientNetworkLayerReleaseBuffer(UA_Connection *connection, UA_ByteString *buf) {
27313  UA_ByteString_deleteMembers(buf);
27314 }
27315 
27316 static void
27317 ClientNetworkLayerClose(UA_Connection *connection) {
27318 #ifdef UA_ENABLE_MULTITHREADING
27319  if(uatomic_xchg(&connection->state, UA_CONNECTION_CLOSED) == UA_CONNECTION_CLOSED)
27320  return;
27321 #else
27322  if(connection->state == UA_CONNECTION_CLOSED)
27323  return;
27324  connection->state = UA_CONNECTION_CLOSED;
27325 #endif
27326  socket_close(connection);
27327 }
27328 
27329 /* we have no networklayer. instead, attach the reusable buffer to the handle */
27331 UA_ClientConnectionTCP(UA_ConnectionConfig conf, const char *endpointUrl,
27332  UA_Logger logger) {
27333 #ifdef _WIN32
27334  WORD wVersionRequested;
27335  WSADATA wsaData;
27336  wVersionRequested = MAKEWORD(2, 2);
27337  WSAStartup(wVersionRequested, &wsaData);
27338 #endif
27339 
27340  UA_Connection connection;
27341  memset(&connection, 0, sizeof(UA_Connection));
27342  connection.state = UA_CONNECTION_OPENING;
27343  connection.localConf = conf;
27344  connection.remoteConf = conf;
27345  connection.send = socket_write;
27346  connection.recv = socket_recv;
27347  connection.close = ClientNetworkLayerClose;
27348  connection.getSendBuffer = ClientNetworkLayerGetBuffer;
27349  connection.releaseSendBuffer = ClientNetworkLayerReleaseBuffer;
27350  connection.releaseRecvBuffer = ClientNetworkLayerReleaseBuffer;
27351 
27352  char hostname[512];
27353  UA_UInt16 port = 0;
27354  const char *path = NULL;
27355 
27356  UA_StatusCode parse_retval = UA_EndpointUrl_split(endpointUrl, hostname, &port, &path);
27357  if(parse_retval != UA_STATUSCODE_GOOD) {
27358  if(parse_retval == UA_STATUSCODE_BADOUTOFRANGE)
27359  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27360  "Server url is invalid: %s", endpointUrl);
27361  else if(parse_retval == UA_STATUSCODE_BADATTRIBUTEIDINVALID)
27362  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27363  "Server url does not begin with 'opc.tcp://' '%s'",
27364  endpointUrl);
27365  return connection;
27366  }
27367 
27368  if(port == 0) {
27369  port = 4840;
27370  UA_LOG_INFO(logger, UA_LOGCATEGORY_NETWORK,
27371  "No port defined, using standard port %d", port);
27372  }
27373 
27374  struct addrinfo hints, *server;
27375  memset(&hints, 0, sizeof(hints));
27376  hints.ai_socktype = SOCK_STREAM;
27377  hints.ai_family = AF_INET;
27378  char portStr[6];
27379 #ifndef _MSC_VER
27380  snprintf(portStr, 6, "%d", port);
27381 #else
27382  _snprintf_s(portStr, 6, _TRUNCATE, "%d", port);
27383 #endif
27384  int error = getaddrinfo(hostname, portStr, &hints, &server);
27385  if(error != 0 || !server) {
27386  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27387  "DNS lookup of %s failed with error %s",
27388  hostname, gai_strerror(error));
27389  return connection;
27390  }
27391 
27392  /* Get a socket */
27393  SOCKET clientsockfd = socket(server->ai_family, server->ai_socktype,
27394  server->ai_protocol);
27395 #ifdef _WIN32
27396  if(clientsockfd == INVALID_SOCKET) {
27397 #else
27398  if(clientsockfd < 0) {
27399 #endif
27400  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27401  "Could not create client socket");
27402  freeaddrinfo(server);
27403  return connection;
27404  }
27405 
27406  /* Connect to the server */
27407  connection.sockfd = (UA_Int32)clientsockfd; /* cast for win32 */
27408  error = connect(clientsockfd, server->ai_addr, WIN32_INT server->ai_addrlen);
27409  freeaddrinfo(server);
27410  if(error < 0) {
27411  ClientNetworkLayerClose(&connection);
27412 #ifdef _WIN32
27413  wchar_t *s = NULL;
27414  FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
27415  FORMAT_MESSAGE_FROM_SYSTEM |
27416  FORMAT_MESSAGE_IGNORE_INSERTS,
27417  NULL, WSAGetLastError(),
27418  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
27419  (LPWSTR)&s, 0, NULL);
27420  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27421  "Connection to %s failed. Error: %d: %S",
27422  endpointUrl, WSAGetLastError(), s);
27423  LocalFree(s);
27424 #else
27425  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27426  "Connection to %s failed. Error: %d: %s",
27427  endpointUrl, errno, strerror(errno));
27428 #endif
27429  return connection;
27430  }
27431 
27432 #ifdef SO_NOSIGPIPE
27433  int val = 1;
27434  int sso_result = setsockopt(connection.sockfd,
27435  SOL_SOCKET, SO_NOSIGPIPE,
27436  (void*)&val, sizeof(val));
27437  if(sso_result < 0)
27438  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27439  "Couldn't set SO_NOSIGPIPE");
27440 #endif
27441 
27442  return connection;
27443 }
27444 
27445 /*********************************** amalgamated original file "/home/iosb/sw/open62541/plugins/ua_clock.c" ***********************************/
27446 
27447 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
27448  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
27449 
27450 
27451 #include <time.h>
27452 #ifdef _WIN32
27453 # ifdef SLIST_ENTRY
27454 # undef SLIST_ENTRY /* Fix redefinition of SLIST_ENTRY on mingw winnt.h */
27455 # endif
27456 # include <windows.h>
27457 #else
27458 # include <sys/time.h>
27459 #endif
27460 
27461 #if defined(__APPLE__) || defined(__MACH__)
27462 # include <mach/clock.h>
27463 # include <mach/mach.h>
27464 #endif
27465 
27467 #if defined(_WIN32)
27468  /* Windows filetime has the same definition as UA_DateTime */
27469  FILETIME ft;
27470  SYSTEMTIME st;
27471  GetSystemTime(&st);
27472  SystemTimeToFileTime(&st, &ft);
27473  ULARGE_INTEGER ul;
27474  ul.LowPart = ft.dwLowDateTime;
27475  ul.HighPart = ft.dwHighDateTime;
27476  return (UA_DateTime)ul.QuadPart;
27477 #else
27478  struct timeval tv;
27479  gettimeofday(&tv, NULL);
27480  return (tv.tv_sec * UA_SEC_TO_DATETIME) + (tv.tv_usec * UA_USEC_TO_DATETIME) + UA_DATETIME_UNIX_EPOCH;
27481 #endif
27482 }
27483 
27485 #if defined(_WIN32)
27486  LARGE_INTEGER freq, ticks;
27487  QueryPerformanceFrequency(&freq);
27488  QueryPerformanceCounter(&ticks);
27489  UA_Double ticks2dt = UA_SEC_TO_DATETIME / (UA_Double)freq.QuadPart;
27490  return (UA_DateTime)(ticks.QuadPart * ticks2dt);
27491 #elif defined(__APPLE__) || defined(__MACH__)
27492  /* OS X does not have clock_gettime, use clock_get_time */
27493  clock_serv_t cclock;
27494  mach_timespec_t mts;
27495  host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock);
27496  clock_get_time(cclock, &mts);
27497  mach_port_deallocate(mach_task_self(), cclock);
27498  return (mts.tv_sec * UA_SEC_TO_DATETIME) + (mts.tv_nsec / 100);
27499 #elif !defined(CLOCK_MONOTONIC_RAW)
27500  struct timespec ts;
27501  clock_gettime(CLOCK_MONOTONIC, &ts);
27502  return (ts.tv_sec * UA_SEC_TO_DATETIME) + (ts.tv_nsec / 100);
27503 #else
27504  struct timespec ts;
27505  clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
27506  return (ts.tv_sec * UA_SEC_TO_DATETIME) + (ts.tv_nsec / 100);
27507 #endif
27508 }
27509 
27510 /*********************************** amalgamated original file "/home/iosb/sw/open62541/plugins/ua_log_stdout.c" ***********************************/
27511 
27512 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
27513  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
27514 
27515 #include <stdio.h>
27516 #include <stdarg.h>
27517 
27518 #ifdef UA_ENABLE_MULTITHREADING
27519 #include <pthread.h>
27520 static pthread_mutex_t printf_mutex = PTHREAD_MUTEX_INITIALIZER;
27521 #endif
27522 
27523 const char *LogLevelNames[6] = {"trace", "debug", "info", "warning", "error", "fatal"};
27524 const char *LogCategoryNames[6] = {"network", "channel", "session", "server", "client", "userland"};
27525 
27526 #if (defined(__GNUC__) && defined(__GNUC_MINOR__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6) || \
27527  defined(__clang__)
27528 # pragma GCC diagnostic push
27529 # pragma GCC diagnostic ignored "-Wformat-nonliteral"
27530 #endif
27531 
27532 void
27534  const char *msg, va_list args) {
27536 #ifdef UA_ENABLE_MULTITHREADING
27537  pthread_mutex_lock(&printf_mutex);
27538 #endif
27539  printf("[%.23s] %s/%s\t", t.data, LogLevelNames[level], LogCategoryNames[category]);
27540  vprintf(msg, args);
27541  printf("\n");
27542  fflush(stdout);
27543 #ifdef UA_ENABLE_MULTITHREADING
27544  pthread_mutex_unlock(&printf_mutex);
27545 #endif
27546  UA_ByteString_deleteMembers(&t);
27547 }
27548 
27549 #if (defined(__GNUC__) && defined(__GNUC_MINOR__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6) || \
27550  defined(__clang__)
27551 # pragma GCC diagnostic pop
27552 #endif
27553 
27554 /*********************************** amalgamated original file "/home/iosb/sw/open62541/plugins/ua_config_standard.c" ***********************************/
27555 
27556 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
27557  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
27558 
27559 
27560 /*******************************/
27561 /* Default Connection Settings */
27562 /*******************************/
27563 
27565  .protocolVersion = 0,
27566  .sendBufferSize = 65535, /* 64k per chunk */
27567  .recvBufferSize = 65535, /* 64k per chunk */
27568  .maxMessageSize = 0, /* 0 -> unlimited */
27569  .maxChunkCount = 0 /* 0 -> unlimited */
27570 };
27571 
27572 /***************************/
27573 /* Default Server Settings */
27574 /***************************/
27575 
27576 #define MANUFACTURER_NAME "open62541"
27577 #define PRODUCT_NAME "open62541 OPC UA Server"
27578 #define PRODUCT_URI "http://open62541.org"
27579 #define APPLICATION_NAME "open62541-based OPC UA Application"
27580 #define APPLICATION_URI "urn:unconfigured:application"
27581 
27582 #define UA_STRING_STATIC(s) {sizeof(s)-1, (UA_Byte*)s}
27583 #define UA_STRING_STATIC_NULL {0, NULL}
27584 
27585 #define STRINGIFY(arg) #arg
27586 #define VERSION(MAJOR, MINOR, PATCH, LABEL) \
27587  STRINGIFY(MAJOR) "." STRINGIFY(MINOR) "." STRINGIFY(PATCH) LABEL
27588 
27590  { UA_STRING_STATIC("user1"), UA_STRING_STATIC("password") },
27591  { UA_STRING_STATIC("user2"), UA_STRING_STATIC("password1") } };
27592 
27594  .nThreads = 1,
27595  .logger = UA_Log_Stdout,
27596 
27597  /* Server Description */
27598  .buildInfo = {
27599  .productUri = UA_STRING_STATIC(PRODUCT_URI),
27600  .manufacturerName = UA_STRING_STATIC(MANUFACTURER_NAME),
27601  .productName = UA_STRING_STATIC(PRODUCT_NAME),
27602  .softwareVersion = UA_STRING_STATIC(VERSION(UA_OPEN62541_VER_MAJOR,
27606  .buildNumber = UA_STRING_STATIC(__DATE__ " " __TIME__),
27607  .buildDate = 0 },
27608  .applicationDescription = {
27609  .applicationUri = UA_STRING_STATIC(APPLICATION_URI),
27610  .productUri = UA_STRING_STATIC(PRODUCT_URI),
27611  .applicationName = { .locale = UA_STRING_STATIC("en"),
27613  .applicationType = UA_APPLICATIONTYPE_SERVER,
27614  .gatewayServerUri = UA_STRING_STATIC_NULL,
27615  .discoveryProfileUri = UA_STRING_STATIC_NULL,
27616  .discoveryUrlsSize = 0,
27617  .discoveryUrls = NULL },
27618  .serverCertificate = UA_STRING_STATIC_NULL,
27619 
27620  /* Networking */
27621  .networkLayersSize = 0,
27622  .networkLayers = NULL,
27623 
27624  /* Login */
27625  .enableAnonymousLogin = true,
27626  .enableUsernamePasswordLogin = true,
27627  .usernamePasswordLogins = usernamePasswords,
27628  .usernamePasswordLoginsSize = 2,
27629 
27630  /* Limits for SecureChannels */
27631  .maxSecureChannels = 40,
27632  .maxSecurityTokenLifetime = 10 * 60 * 1000, /* 10 minutes */
27633 
27634  /* Limits for Sessions */
27635  .maxSessions = 100,
27636  .maxSessionTimeout = 60.0 * 60.0 * 1000.0, /* 1h */
27637 
27638  /* Limits for Subscriptions */
27639  .publishingIntervalLimits = { .min = 100.0, .max = 3600.0 * 1000.0 },
27640  .lifeTimeCountLimits = { .max = 15000, .min = 3 },
27641  .keepAliveCountLimits = { .max = 100, .min = 1 },
27642  .maxNotificationsPerPublish = 1000,
27643  .maxRetransmissionQueueSize = 0, /* unlimited */
27644 
27645  /* Limits for MonitoredItems */
27646  .samplingIntervalLimits = { .min = 50.0, .max = 24.0 * 3600.0 * 1000.0 },
27647  .queueSizeLimits = { .max = 100, .min = 1 }
27648 };
27649 
27650 /***************************/
27651 /* Default Client Settings */
27652 /***************************/
27653 
27654 const UA_EXPORT UA_ClientConfig UA_ClientConfig_standard = {
27655  .timeout = 5000, /* 5 seconds */
27656  .secureChannelLifeTime = 10 * 60 * 1000, /* 10 minutes */
27657  .logger = UA_Log_Stdout,
27658  .localConnectionConfig = {
27659  .protocolVersion = 0,
27660  .sendBufferSize = 65535, /* 64k per chunk */
27661  .recvBufferSize = 65535, /* 64k per chunk */
27662  .maxMessageSize = 0, /* 0 -> unlimited */
27663  .maxChunkCount = 0 /* 0 -> unlimited */
27664  },
27665  .connectionFunc = UA_ClientConnectionTCP
27666 };
27667 /****************************************/
27668 /* Default Client Subscription Settings */
27669 /****************************************/
27670 
27671 #ifdef UA_ENABLE_SUBSCRIPTIONS
27672 
27673 const UA_SubscriptionSettings UA_SubscriptionSettings_standard = {
27674  .requestedPublishingInterval = 500.0,
27675  .requestedLifetimeCount = 10000,
27676  .requestedMaxKeepAliveCount = 1,
27677  .maxNotificationsPerPublish = 10,
27678  .publishingEnabled = true,
27679  .priority = 0
27680 };
27681 
27682 #endif
UA_Int32 i32
Definition: open62541.c:778
UA_EndpointDescription * serverEndpoints
Definition: open62541.h:5159
UA_String * profileUris
Definition: open62541.h:4470
UA_SecureChannel * channel
Definition: open62541.h:9482
#define UA_NS0ID_BROWSENEXTREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2131
#define LIST_HEAD(name, type)
Definition: open62541.c:197
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXQUERYCONTINUATIONPOINTS
Definition: open62541.h:2612
#define UA_NS0ID_UNREGISTERNODESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2164
UA_StatusCode UA_Server_addReference(UA_Server *server, const UA_NodeId sourceId, const UA_NodeId refTypeId, const UA_ExpandedNodeId targetId, UA_Boolean isForward)
Definition: open62541.c:22329
void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session, const UA_TranslateBrowsePathsToNodeIdsRequest *request, UA_TranslateBrowsePathsToNodeIdsResponse *response)
Definition: open62541.c:23261
UA_StatusCode UA_Client_connect_username(UA_Client *client, const char *endpointUrl, const char *username, const char *password)
Definition: open62541.c:25268
UA_ResponseHeader responseHeader
Definition: open62541.h:4630
UA_NodeId authenticationToken
Definition: open62541.c:4752
#define UA_NS0ID_SERVERTYPE
Definition: open62541.h:2488
#define UA_STATUSCODE_BADSHELVINGTIMEOUTOFRANGE
Definition: open62541.h:835
UA_TimestampsToReturn timestampsToReturn
Definition: open62541.h:4531
#define UA_NS0ID_MODIFYMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2361
WriteValue ^^^^^^^^^^.
Definition: open62541.h:3632
UA_StatusCode(* recv)(UA_Connection *connection, UA_ByteString *response, UA_UInt32 timeout)
Definition: open62541.h:9516
size_t continuationPointsSize
Definition: open62541.h:4217
#define UA_TYPES_SETMONITORINGMODERESPONSE
Definition: open62541.h:4550
UA_VariantStorageType storageType
Definition: open62541.h:1401
UA_SecureChannelManager secureChannelManager
Definition: open62541.c:4216
void UA_Variant_setScalar(UA_Variant *v, void *UA_RESTRICT p, const UA_DataType *type)
Definition: open62541.c:5165
#define UA_STATUSCODE_BADDEADBANDFILTERINVALID
Definition: open62541.h:814
#define UA_STATUSCODE_UNCERTAININITIALVALUE
Definition: open62541.h:818
#define UA_EXPORT
Function Export On Win32: Define UA_DYNAMIC_LINKING and UA_DYNAMIC_LINKING_EXPORT in order to export ...
Definition: open62541.h:143
#define FLOAT_NEG_ZERO
Definition: open62541.c:6176
UA_UInt32 requestHandle
Definition: open62541.h:3303
#define UA_NodeStore_newVariableTypeNode()
Definition: open62541.c:3993
#define UA_STATUSCODE_BADVIEWPARAMETERMISMATCH
Definition: open62541.h:771
UA_Byte eventNotifier
Definition: open62541.h:3270
#define UA_NS0ID_ENUMERATION
Definition: open62541.h:1824
UA_Boolean symmetric
Definition: open62541.c:3653
SequenceHeader ^^^^^^^^^^^^^^ Secure Layer Sequence Header.
Definition: open62541.c:2617
struct UA_ExtensionObject::@1::@2 encoded
uint32_t UA_UInt32
UInt32 ^^^^^^ An integer value between 0 and 4 294 967 295.
Definition: open62541.h:970
#define UA_TYPES_METHODATTRIBUTES
Definition: open62541.h:3612
size_t arrayLength
Definition: open62541.h:1402
#define UA_BINARY_OVERLAYABLE_INTEGER
String Manipulation The header string.h is defined in the C-standard.
Definition: open62541.h:247
#define UA_STATUSCODE_BADDEVICEFAILURE
Definition: open62541.h:811
UA_Session adminSession
Definition: open62541.c:15613
#define UA_NS0ID_FROMSTATE
Definition: open62541.h:1843
void UA_SecureChannel_revolveTokens(UA_SecureChannel *channel)
Definition: open62541.c:15259
UA_UInt32 maxMessageSize
Definition: open62541.c:2552
#define UA_NS0ID_SERVERSTATUSDATATYPE
Definition: open62541.h:2448
#define UA_TYPES_SIGNATUREDATA
Definition: open62541.h:3693
UA_ResponseHeader responseHeader
Definition: open62541.h:4934
#define UA_STATUSCODE_BADINSUFFICIENTCLIENTPROFILE
Definition: open62541.h:794
UA_QualifiedName targetName
Definition: open62541.h:3477
#define UA_STATUSCODE_BADEVENTFILTERINVALID
Definition: open62541.h:726
#define UA_NS0ID_BUILDINFO
Definition: open62541.h:1958
Definition: open62541.c:3706
#define container_of(ptr, type, member)
Definition: open62541.c:749
UA_StatusCode UA_Server_forEachChildNodeCall(UA_Server *server, UA_NodeId parentNodeId, UA_NodeIteratorCallback callback, void *handle)
Definition: open62541.c:15789
ApplicationDescription ^^^^^^^^^^^^^^^^^^^^^^ Describes an application and how to find it...
Definition: open62541.h:4906
#define UA_NS0ID_SERVER_VENDORSERVERINFO
Definition: open62541.h:2572
void Service_DeleteNodes(UA_Server *server, UA_Session *session, const UA_DeleteNodesRequest *request, UA_DeleteNodesResponse *response)
Definition: open62541.c:22387
UA_LogCategory
Definition: open62541.h:9639
UA_NodeId referenceTypeId
Definition: open62541.h:3474
UA_BrowsePathResult UA_Server_translateBrowsePathToNodeIds(UA_Server *server, const UA_BrowsePath *browsePath)
Definition: open62541.c:23251
#define NULL
size_t resultsSize
Definition: open62541.h:4202
#define UA_NS0ID_FINDSERVERSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2020
#define UA_TYPES_QUERYDATASET
Definition: open62541.h:3546
#define UA_OPEN62541_VER_LABEL
Definition: open62541.h:42
#define UA_STATUSCODE_BADSERVERNOTCONNECTED
Definition: open62541.h:666
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_MANUFACTURERNAME
Definition: open62541.h:2547
TcpMessageHeader ^^^^^^^^^^^^^^^^ TCP Header.
Definition: open62541.c:2628
#define UA_NS0ID_ORGANIZES
Definition: open62541.h:1830
#define UA_STATUSCODE_UNCERTAINDATASUBNORMAL
Definition: open62541.h:846
UA_ApplicationType
ApplicationType ^^^^^^^^^^^^^^^ The types of applications.
Definition: open62541.h:4097
const UA_EXPORT UA_ConnectionConfig UA_ConnectionConfig_standard
Definition: open62541.c:27564
UA_StatusCode UA_NodeStore_remove(UA_NodeStore *ns, const UA_NodeId *nodeid)
Definition: open62541.c:19462
UA_MonitoredItemNotification * monitoredItems
Definition: open62541.h:4507
#define UA_STATUSCODE_GOODDATAIGNORED
Definition: open62541.h:853
#define UA_STATUSCODE_BADENCODINGERROR
Definition: open62541.h:657
#define UA_TYPES_DELETEMONITOREDITEMSREQUEST
Definition: open62541.h:4363
UA_UInt16 typeIndex
Definition: open62541.h:1656
#define UA_TYPES_SETPUBLISHINGMODEREQUEST
Definition: open62541.h:3569
void UA_Subscription_publishCallback(UA_Server *server, UA_Subscription *sub)
#define UA_TYPES_MODIFYMONITOREDITEMSREQUEST
Definition: open62541.h:4536
#define UA_STATUSCODE_BADCERTIFICATEINVALID
Definition: open62541.h:672
UA_ByteString incompleteMessage
Definition: open62541.h:9488
#define UA_TYPES_DELETEREFERENCESITEM
Definition: open62541.h:3626
UA_Variant value
Definition: open62541.h:1574
#define APPLICATION_NAME
Definition: open62541.c:27579
void(* UA_Service)(UA_Server *, UA_Session *, const void *request, void *response)
Definition: open62541.c:4403
UA_StatusCode innerStatusCode
Definition: open62541.h:1600
UA_NodeStore * UA_NodeStore_new(void)
Nodestore Lifecycle ^^^^^^^^^^^^^^^^^^^.
Definition: open62541.c:19337
UA_String endpointUrl
Definition: open62541.c:2554
#define UA_TYPES_SIGNEDSOFTWARECERTIFICATE
Definition: open62541.h:3246
#define STARTTOKENID
Definition: open62541.c:18632
#define LIST_NEXT(elm, field)
Definition: open62541.c:217
UA_AddNodesItem * nodesToAdd
Definition: open62541.h:4991
UA_MonitoredItem * UA_MonitoredItem_new(void)
UA_Boolean UA_Guid_equal(const UA_Guid *g1, const UA_Guid *g2)
Definition: open62541.c:4914
AddReferencesItem ^^^^^^^^^^^^^^^^^ A request to add a reference to the server address space...
Definition: open62541.h:4614
UA_StatusCode UA_SecureChannelManager_close(UA_SecureChannelManager *cm, UA_UInt32 channelId)
Definition: open62541.c:18803
#define UA_TYPES_READVALUEID
Definition: open62541.h:3880
#define UA_TYPES_BROWSEPATH
Definition: open62541.h:5019
UA_UInt32 requestId
Definition: open62541.c:3224
UA_String username
Definition: open62541.c:4747
UA_Boolean containsNoLoops
Definition: open62541.c:3688
UA_ByteString serverCertificate
Definition: open62541.h:5071
void UA_Client_reset(UA_Client *client)
Definition: open62541.c:24721
#define UA_NS0ID_REFERENCETYPESFOLDER
Definition: open62541.h:1869
UA_DateTime publishTime
Definition: open62541.h:3375
UA_StatusCode statusCode
Definition: open62541.h:5026
UA_NODE_BASEATTRIBUTES UA_Boolean isAbstract
Definition: open62541.c:3652
RelativePath ^^^^^^^^^^^^ A relative path constructed from reference types and browse names...
Definition: open62541.h:4657
UA_TcpMessageHeader messageHeader
Definition: open62541.c:2664
TranslateBrowsePathsToNodeIdsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Translates one or more path...
Definition: open62541.h:5125
UA_UInt32 size
Definition: open62541.c:19173
UA_QualifiedName browseName
Definition: open62541.h:4817
#define UA_STATUSCODE_BADCONDITIONALREADYDISABLED
Definition: open62541.h:824
struct UA_NodeStoreEntry * orig
Definition: open62541.c:19165
UA_DeleteNodesItem * nodesToDelete
Definition: open62541.h:3984
#define UA_STATUSCODE_BADDUPLICATEREFERENCENOTALLOWED
Definition: open62541.h:763
#define UA_STATUSCODE_UNCERTAINREFERENCENOTDELETED
Definition: open62541.h:767
UA_String UA_ByteString
ByteString ^^^^^^^^^^ A sequence of octets.
Definition: open62541.h:1122
#define UA_STATUSCODE_BADINDEXRANGEINVALID
Definition: open62541.h:709
UA_Byte data4[8]
Definition: open62541.h:1111
#define UA_NS0ID_QUALIFIEDNAME
Definition: open62541.h:1815
size_t namespacesSize
Definition: open62541.c:4222
UA_StatusCode UA_Client_manuallyRenewSecureChannel(UA_Client *client)
Definition: open62541.c:25337
UA_LogLevel
Logging
Definition: open62541.h:9630
UA_NodeId dataType
Definition: open62541.h:3713
UA_StatusCode Subscription_unregisterPublishJob(UA_Server *server, UA_Subscription *sub)
#define UA_STATUSCODE_BADCERTIFICATEUNTRUSTED
Definition: open62541.h:680
void(* UA_deleteMembersSignature)(void *p, const UA_DataType *type)
Definition: open62541.c:5691
CreateSessionRequest ^^^^^^^^^^^^^^^^^^^^ Creates a new session with the server.
Definition: open62541.h:5038
UA_String securityPolicyUri
Definition: open62541.h:4347
size_t resultsSize
Definition: open62541.h:4775
UA_UInt32 userWriteMask
Definition: open62541.h:3960
void UA_Server_deleteAllRepeatedJobs(UA_Server *server)
Definition: open62541.c:18266
#define UA_NS0ID_OBJECTSFOLDER
Definition: open62541.h:1863
#define MAXBACKLOG
For the multithreaded mode, assume a single thread that periodically "gets work" from the network lay...
Definition: open62541.c:26944
struct UA_ExtensionObject::@1::@3 decoded
#define UA_STATUSCODE_BADCONTINUATIONPOINTINVALID
Definition: open62541.h:734
QueryFirstRequest ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:5172
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_SOFTWAREVERSION
Definition: open62541.h:2548
#define UA_NS0ID_BOOLEAN
Definition: open62541.h:1796
UA_StatusCode UA_Server_editNode(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, UA_EditNodeCallback callback, const void *data)
Definition: open62541.c:17895
#define UA_TYPES_GUID
Guid ^^^^.
Definition: open62541.h:3169
#define UA_STATUSCODE_BADCONDITIONDISABLED
Definition: open62541.h:826
FindServersRequest ^^^^^^^^^^^^^^^^^^ Finds the servers known to the discovery server.
Definition: open62541.h:4556
#define UA_NS0ID_TRANSLATEBROWSEPATHSTONODEIDSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2152
#define MAX_PICO_SECONDS
Definition: open62541.c:7034
UA_ResponseHeader responseHeader
Definition: open62541.h:4085
#define UA_STATUSCODE_BADOUTOFSERVICE
Definition: open62541.h:813
#define TAILQ_REMOVE(head, elm, field)
Definition: open62541.c:526
AddNodesItem ^^^^^^^^^^^^ A request to add a node to the server address space.
Definition: open62541.h:4813
#define UA_STATUSCODE_BADCONNECTIONREJECTED
Definition: open62541.h:867
SymmetricAlgorithmSecurityHeader ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Secure Layer Symmetric Algorithm He...
Definition: open62541.c:2653
#define UA_RCU_UNLOCK()
Definition: open62541.c:4187
UA_SecureChannel channel
Definition: open62541.c:4105
struct ServerNetworkLayerTCP::ConnectionMapping * mappings
UA_ExtensionObjectEncoding encoding
Definition: open62541.h:1548
UA_ByteString continuationPoint
Definition: open62541.h:5027
void UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection, const UA_ByteString *message)
Definition: open62541.c:17575
#define UA_NodeStore_newObjectTypeNode()
Definition: open62541.c:3991
#define CHECK_NODECLASS(CLASS)
Definition: open62541.c:20697
CreateMonitoredItemsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4945
struct UA_Job::@5::@6 binaryMessage
#define TAILQ_FOREACH(var, head, field)
Definition: open62541.c:461
UA_StatusCode UA_Client_NamespaceGetIndex(UA_Client *client, UA_String *namespaceUri, UA_UInt16 *namespaceIndex)
Definition: open62541.c:25512
#define CHECK_DATATYPE_ARRAY(EXP_DT)
Definition: open62541.c:21008
ServiceFault ^^^^^^^^^^^^ The response returned by all services when there is a service level error...
Definition: open62541.h:4923
#define UA_NS0ID_CREATESESSIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2059
#define UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE
Definition: open62541.c:2611
#define UA_STATUSCODE_BADDISCONNECT
Definition: open62541.h:868
#define UA_NS0ID_VARIABLETYPESFOLDER
Definition: open62541.h:1867
UA_StatusCode UA_SecureChannel_processChunks(UA_SecureChannel *channel, const UA_ByteString *chunks, UA_ProcessMessageCallback callback, void *application)
Definition: open62541.c:15507
#define UA_TYPES_WRITEREQUEST
Definition: open62541.h:4416
UA_CallMethodResult UA_EXPORT UA_Server_call(UA_Server *server, const UA_CallMethodRequest *request)
Method Call
#define UA_STATUSCODE_BADINTERNALERROR
Definition: open62541.h:653
UA_MonitoringMode
MonitoringMode ^^^^^^^^^^^^^^.
Definition: open62541.h:3429
CreateSubscriptionRequest ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4227
struct UA_MonitoredItem UA_MonitoredItem
UA_ChannelSecurityToken securityToken
Definition: open62541.h:4087
#define UA_TYPES_ACTIVATESESSIONREQUEST
Definition: open62541.h:4078
#define UA_INT32_MAX
Definition: open62541.h:964
#define UA_TYPES_GETENDPOINTSREQUEST
Definition: open62541.h:4473
bool UA_Boolean
Boolean ^^^^^^^ A two-state logical value (true or false).
Definition: open62541.h:922
#define UA_TYPES_DATAVALUE
DataValue ^^^^^^^^^.
Definition: open62541.h:3223
void UA_Client_delete(UA_Client *client)
Definition: open62541.c:24726
#define UA_NS0ID_BASEDATATYPE
Definition: open62541.h:1819
#define UA_STATUSCODE_UNCERTAINREFERENCEOUTOFSERVER
Definition: open62541.h:776
DiagnosticInfo ^^^^^^^^^^^^^^ A structure that contains detailed error and diagnostic information ass...
Definition: open62541.h:1587
#define UA_TYPES_INT16
Int16 ^^^^^.
Definition: open62541.h:3109
#define SIMPLEQ_ENTRY(type)
Definition: open62541.c:289
#define UA_TRANSPORT_TCPHELLOMESSAGE
Definition: open62541.c:2557
UA_DateTime UA_DateTime_now(void)
Definition: open62541.c:27466
DataTypeAttributes ^^^^^^^^^^^^^^^^^^ The attributes for a data type node.
Definition: open62541.h:3886
#define UA_INLINE
Inline Functions
Definition: open62541.h:152
TcpAcknowledgeMessage ^^^^^^^^^^^^^^^^^^^^^ Acknowledge Message.
Definition: open62541.c:2603
UA_StatusCode UA_SessionManager_createSession(UA_SessionManager *sm, UA_SecureChannel *channel, const UA_CreateSessionRequest *request, UA_Session **session)
Definition: open62541.c:18909
#define LEAPOCH
Definition: open62541.c:26303
UA_StatusCode UA_Server_addDataSourceVariableNode(UA_Server *server, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, const UA_QualifiedName browseName, const UA_NodeId typeDefinition, const UA_VariableAttributes attr, const UA_DataSource dataSource, UA_NodeId *outNewNodeId)
Definition: open62541.c:22075
UA_StatusCode UA_Client_connect(UA_Client *client, const char *endpointUrl)
Definition: open62541.c:25278
UA_StatusCode UA_Client_disconnect(UA_Client *client)
Definition: open62541.c:25323
const UA_ExpandedNodeId UA_EXPANDEDNODEID_NULL
Definition: open62541.c:4785
#define UA_TYPES_PUBLISHREQUEST
Definition: open62541.h:4485
struct MonitoredItem_queuedValue MonitoredItem_queuedValue
UA_ServerCallback method
Definition: open62541.h:9594
const UA_DataType * responseType
Definition: open62541.c:25353
UA_RelativePathElement * elements
Definition: open62541.h:4659
UA_UInt16 milliSec
Definition: open62541.h:1090
QueryNextRequest ^^^^^^^^^^^^^^^^.
Definition: open62541.h:4188
UA_StatusCode UA_Client_forEachChildNodeCall(UA_Client *client, UA_NodeId parentNodeId, UA_NodeIteratorCallback callback, void *handle)
Definition: open62541.c:25553
#define UA_STATUSCODE_BADNODEIDUNKNOWN
Definition: open62541.h:707
#define UA_TYPES_OPENSECURECHANNELREQUEST
Definition: open62541.h:4297
#define UA_NS0ID_SERVER_SERVERSTATUS_STATE
Definition: open62541.h:2543
#define UA_STATUSCODE_BADWOULDBLOCK
Definition: open62541.h:876
UA_StatusCode UA_NodeStore_insert(UA_NodeStore *ns, UA_Node *node)
Insert / Get / Replace / Remove ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.c:19380
#define UA_NS0ID_HASENCODING
Definition: open62541.h:1833
#define UA_NS0ID_NONHIERARCHICALREFERENCES
Definition: open62541.h:1827
SignatureData ^^^^^^^^^^^^^ A digital signature.
Definition: open62541.h:3688
#define UA_TYPES_CLOSESECURECHANNELRESPONSE
Definition: open62541.h:4522
DeleteSubscriptionsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3917
#define UA_STATUSCODE_BADINDEXRANGENODATA
Definition: open62541.h:710
UA_Node * UA_NodeStore_getCopy(UA_NodeStore *ns, const UA_NodeId *nodeid)
Definition: open62541.c:19445
UA_Double revisedSessionTimeout
Definition: open62541.h:5155
#define UA_STATUSCODE_GOODENTRYREPLACED
Definition: open62541.h:845
size_t UA_readNumber(UA_Byte *buf, size_t buflen, UA_UInt32 *number)
Definition: open62541.c:15138
UA_ServerState state
Definition: open62541.h:4832
UA_UserTokenType tokenType
Definition: open62541.h:4344
UA_DataValue value
Definition: open62541.h:3636
#define UA_TYPES_WRITERESPONSE
Definition: open62541.h:4208
#define UA_STATUSCODE_BADMONITOREDITEMFILTERINVALID
Definition: open62541.h:722
double UA_Double
Double ^^^^^^ An IEEE double precision (64 bit) floating point value.
Definition: open62541.h:1001
MonitoredItemModifyResult ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3316
#define UA_LOG_INFO_SESSION(LOGGER, SESSION, MSG,...)
Definition: open62541.c:3787
#define SLIST_FOREACH_SAFE(var, head, field, tvar)
Definition: open62541.c:150
#define UA_NS0ID_INT64
Definition: open62541.h:1803
UA_MonitoredItemCreateResult * results
Definition: open62541.h:4685
UA_ResponseHeader responseHeader
Definition: open62541.h:5152
#define UA_STATUSCODE_BADSTATENOTACTIVE
Definition: open62541.h:795
#define UA_STATUSCODE_BADTARGETNODEIDINVALID
Definition: open62541.h:762
#define SLIST_REMOVE(head, elm, type, field)
Definition: open62541.c:180
void * handle
Definition: open62541.h:9487
#define UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE
Definition: open62541.h:4282
#define UA_STATUSCODE_BADDIALOGNOTACTIVE
Definition: open62541.h:829
UA_Boolean executable
Definition: open62541.h:3608
#define UA_NS0ID_HASMODELLINGRULE
Definition: open62541.h:1832
UA_StatusCode __UA_Server_read(UA_Server *server, const UA_NodeId *nodeId, const UA_AttributeId attributeId, void *v)
Definition: open62541.c:20950
#define UA_NS0ID_SERVER_AUDITING
Definition: open62541.h:2635
#define UA_STATUSCODE_BADBROWSENAMEDUPLICATED
Definition: open62541.h:758
#define UA_TYPES_SUBSCRIPTIONACKNOWLEDGEMENT
Definition: open62541.h:3867
ReferenceDescription ^^^^^^^^^^^^^^^^^^^^ The description of a reference.
Definition: open62541.h:4571
UA_UInt16 sourcePicoseconds
Definition: open62541.h:1577
#define UA_TYPES_USERIDENTITYTOKEN
Definition: open62541.h:3730
#define UA_STATUSCODE_BADINVALIDSELFREFERENCE
Definition: open62541.h:764
#define UA_STATUSCODE_GOODMOREDATA
Definition: open62541.h:848
#define SLIST_ENTRY(type)
Definition: open62541.c:132
UA_ResponseHeader responseHeader
Definition: open62541.h:5087
UA_DateTime timestamp
Definition: open62541.h:3302
UA_String transportProfileUri
Definition: open62541.h:5076
#define UA_STATUSCODE_BADTOOMANYMATCHES
Definition: open62541.h:777
UA_Client_Authentication
Definition: open62541.c:4726
#define UA_NS0ID_SERVER_SERVERREDUNDANCY
Definition: open62541.h:2573
void Service_UnregisterNodes(UA_Server *server, UA_Session *session, const UA_UnregisterNodesRequest *request, UA_UnregisterNodesResponse *response)
Definition: open62541.c:23300
UA_Int32 symbolicId
Definition: open62541.h:1595
#define UA_TYPES_INT32
Int32 ^^^^^.
Definition: open62541.h:3121
#define UA_NodeStore_newReferenceTypeNode()
Definition: open62541.c:3995
#define UA_STATUSCODE_BADRESPONSETOOLARGE
Definition: open62541.h:661
#define UA_NS0ID_ADDREFERENCESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2092
#define UA_STATUSCODE_BADUSERSIGNATUREINVALID
Definition: open62541.h:747
const UA_ObjectTypeNode * getObjectNodeType(UA_Server *server, const UA_ObjectNode *node)
Definition: open62541.c:17870
BrowseNextRequest ^^^^^^^^^^^^^^^^^ Continues one or more browse operations.
Definition: open62541.h:4214
UA_ResponseHeader responseHeader
Definition: open62541.h:4304
size_t UA_calcSizeBinary(void *p, const UA_DataType *type)
Definition: open62541.c:7564
#define UA_STATUSCODE_BADREFERENCETYPEIDINVALID
Definition: open62541.h:736
UA_Guid UA_Guid_random(void)
Definition: open62541.c:4921
#define UA_NS0ID_INTEGER
Definition: open62541.h:1822
UA_StatusCode MonitoredItem_registerSampleJob(UA_Server *server, UA_MonitoredItem *mon)
#define UA_STATUSCODE_BADCERTIFICATEISSUERREVOKED
Definition: open62541.h:684
#define UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID
Definition: open62541.h:695
#define SIMPLEQ_FIRST(head)
Definition: open62541.c:297
const UA_encodeBinarySignature encodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT+1]
Definition: open62541.c:7178
UA_StatusCode getTypeHierarchy(UA_NodeStore *ns, const UA_Node *rootRef, UA_Boolean inverse, UA_NodeId **typeHierarchy, size_t *typeHierarchySize)
Definition: open62541.c:17728
#define UA_TYPES_COUNT
Every type is assigned an index in an array containing the type descriptions.
Definition: open62541.h:3084
UA_Session * UA_SecureChannel_getSession(UA_SecureChannel *channel, UA_NodeId *token)
Definition: open62541.c:15248
UA_SecureChannel channel
Definition: open62541.c:4741
UA_ResponseHeader responseHeader
Definition: open62541.h:4201
#define UA_OPEN62541_VER_MAJOR
Library Version
Definition: open62541.h:39
#define CLOSESOCKET(S)
Definition: open62541.c:26718
#define UA_NS0ID_HASPROPERTY
Definition: open62541.h:1839
DeleteReferencesRequest ^^^^^^^^^^^^^^^^^^^^^^^ Delete one or more references from the server address...
Definition: open62541.h:4747
#define UA_NS0ID_INT16
Definition: open62541.h:1799
Argument ^^^^^^^^ An argument for a method.
Definition: open62541.h:3711
#define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_LOCALE
Definition: open62541.c:6633
size_t subscriptionAcknowledgementsSize
Definition: open62541.h:4481
#define UA_NS0ID_HASDESCRIPTION
Definition: open62541.h:1834
UA_UInt16 memberTypeIndex
Definition: open62541.h:1635
UserNameIdentityToken ^^^^^^^^^^^^^^^^^^^^^ A token representing a user identified by a user name and...
Definition: open62541.h:4023
UA_UInt32 * arrayDimensions
Definition: open62541.h:1405
UA_StatusCode writeDataTypeAttribute(UA_Server *server, UA_VariableNode *node, const UA_NodeId *dataType, const UA_NodeId *constraintDataType)
Definition: open62541.c:20407
UA_Byte userAccessLevel
Definition: open62541.c:3464
#define UA_TYPES_CLOSESESSIONRESPONSE
Definition: open62541.h:4900
#define UA_NS0ID_MODIFYSUBSCRIPTIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2391
void Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel, UA_Session *session, const UA_ActivateSessionRequest *request, UA_ActivateSessionResponse *response)
Definition: open62541.c:19944
UA_Boolean overlayable
Definition: open62541.h:1662
UA_ExtensionObject additionalHeader
Definition: open62541.h:3908
#define UA_STATUSCODE_BADNOCONTINUATIONPOINTS
Definition: open62541.h:735
UA_StatusCode UA_SessionManager_removeSession(UA_SessionManager *sm, const UA_NodeId *token)
Definition: open62541.c:18936
#define UA_NS0ID_HASORDEREDCOMPONENT
Definition: open62541.h:1842
#define UA_TYPES_DATACHANGEFILTER
Definition: open62541.h:4878
#define UA_STATUSCODE_BADTYPEMISMATCH
Definition: open62541.h:786
UA_Double timeout
Definition: open62541.c:3733
UA_RequestHeader requestHeader
Definition: open62541.h:4316
UA_BrowseDirection browseDirection
Definition: open62541.h:4439
UA_NodeId referenceTypeId
Definition: open62541.h:3700
#define UA_STATUSCODE_BADTCPINTERNALERROR
Definition: open62541.h:801
#define UA_STATUSCODE_BADTCPMESSAGETOOLARGE
Definition: open62541.h:799
void * UA_Array_new(size_t size, const UA_DataType *type)
Definition: open62541.c:5763
CallMethodResult ^^^^^^^^^^^^^^^^.
Definition: open62541.h:3443
#define UA_TYPES_UINT32
UInt32 ^^^^^^.
Definition: open62541.h:3127
UA_UInt16 UA_Server_addNamespace(UA_Server *server, const char *name)
Definition: open62541.c:15780
UA_StatusCode compatibleArrayDimensions(size_t constraintArrayDimensionsSize, const UA_UInt32 *constraintArrayDimensions, size_t testArrayDimensionsSize, const UA_UInt32 *testArrayDimensions)
Definition: open62541.c:20128
AsymmetricAlgorithmSecurityHeader ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Security Header.
Definition: open62541.c:2591
TcpErrorMessage ^^^^^^^^^^^^^^^ Error Message.
Definition: open62541.c:2563
UA_Boolean processed
Definition: open62541.c:25350
#define UA_STATUSCODE_BADNOTIMPLEMENTED
Definition: open62541.h:719
UA_NODE_BASEATTRIBUTES UA_NODE_VARIABLEATTRIBUTES UA_Byte accessLevel
Definition: open62541.c:3463
UA_ExtensionObjectEncoding
Definition: open62541.h:1537
size_t nodesToWriteSize
Definition: open62541.h:4412
UA_VARIANT_ENCODINGMASKTYPE
Definition: open62541.c:6853
#define UA_TYPES_BYTESTRING
ByteString ^^^^^^^^^^.
Definition: open62541.h:3175
UA_UInt32 u32
Definition: open62541.c:777
SignedSoftwareCertificate ^^^^^^^^^^^^^^^^^^^^^^^^^ A software certificate with a digital signature...
Definition: open62541.h:3241
#define UA_STATUSCODE_BADVIEWIDUNKNOWN
Definition: open62541.h:769
#define UA_STATUSCODE_BADNODEATTRIBUTESINVALID
Definition: open62541.h:759
#define UA_TYPES_UINT64
UInt64 ^^^^^^.
Definition: open62541.h:3139
UA_LocalizedText displayName
Definition: open62541.h:3352
#define UA_UINT16_MAX
Definition: open62541.h:956
#define UA_STATUSCODE_BADDATALOST
Definition: open62541.h:839
#define UA_STATUSCODE_BADDEPENDENTVALUECHANGED
Definition: open62541.h:861
#define UA_NS0ID_SERVER_SERVERSTATUS_SECONDSTILLSHUTDOWN
Definition: open62541.h:2633
UA_Boolean UA_Node_hasSubTypeOrInstances(const UA_Node *node)
Definition: open62541.c:17878
UA_String * namespaces
Definition: open62541.c:4223
UA_DataValue * results
Definition: open62541.h:4776
UA_UInt32 requestId
Definition: open62541.c:2619
#define UA_STATUSCODE_BADREQUESTCANCELLEDBYCLIENT
Definition: open62541.h:698
#define UA_STATUSCODE_BADCERTIFICATEHOSTNAMEINVALID
Definition: open62541.h:676
#define UA_STATUSCODE_GOODCALLAGAIN
Definition: open62541.h:864
UA_UInt32 maxRequestMessageSize
Definition: open62541.c:3731
ReadValueId ^^^^^^^^^^^.
Definition: open62541.h:3873
UA_String UA_String_fromChars(char const src[])
Definition: open62541.c:4823
#define CHECK_NODECLASS_WRITE(CLASS)
Definition: open62541.c:21016
#define UA_NS0ID_INT32
Definition: open62541.h:1801
const UA_DataType * UA_findDataType(const UA_NodeId *typeId)
Builtin data types can be accessed as UA_TYPES[UA_TYPES_XXX], where XXX is the name of the data type...
Definition: open62541.c:4790
UA_String additionalInfo
Definition: open62541.h:1599
UA_Int64 i64
Definition: open62541.c:780
#define UA_STATUSCODE_BADDATAENCODINGINVALID
Definition: open62541.h:711
UA_StatusCode UA_SecureChannel_generateNonce(UA_ByteString *nonce)
Definition: open62541.c:15203
UA_String indexRange
Definition: open62541.h:3635
const UA_NodeId UA_NODEID_NULL
Definition: open62541.c:4784
UA_ExtensionObject filter
Definition: open62541.h:3677
#define UA_STATUSCODE_BADCERTIFICATECHAININCOMPLETE
Definition: open62541.h:685
#define UA_STATUSCODE_BADSESSIONIDINVALID
Definition: open62541.h:692
#define DOUBLE_INF
Definition: open62541.c:6209
UA_Connection connection
Definition: open62541.c:4737
uint16_t UA_UInt16
UInt16 ^^^^^^ An integer value between 0 and 65 535.
Definition: open62541.h:954
#define UA_STATUSCODE_BADBROWSENAMEINVALID
Definition: open62541.h:757
#define UA_STATUSCODE_GOODNODATA
Definition: open62541.h:847
#define UA_NS0ID_UINTEGER
Definition: open62541.h:1823
#define UA_NS0ID_HASCAUSE
Definition: open62541.h:1845
UA_LocalizedText inverseName
Definition: open62541.h:4377
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXBROWSECONTINUATIONPOINTS
Definition: open62541.h:2611
#define UA_NS0ID_BASEDATAVARIABLETYPE
Definition: open62541.h:1851
UA_ExtensionObject nodeAttributes
Definition: open62541.h:4819
UA_Boolean hasLocalizedText
Definition: open62541.h:1590
UA_UInt16 data3
Definition: open62541.h:1110
OpenSecureChannelResponse ^^^^^^^^^^^^^^^^^^^^^^^^^ Creates a secure channel with a server...
Definition: open62541.h:4084
void Service_Read_single(UA_Server *server, UA_Session *session, UA_TimestampsToReturn timestamps, const UA_ReadValueId *id, UA_DataValue *v)
Definition: open62541.c:20703
UA_ClientState UA_Client_getState(UA_Client *client)
Definition: open62541.c:24731
UA_Boolean fixedSize
Definition: open62541.h:1660
UA_StatusCode UA_Server_delayedFree(UA_Server *server, void *data)
Definition: open62541.c:18283
#define UA_STATUSCODE_BADTIMESTAMPNOTSUPPORTED
Definition: open62541.h:843
UA_Boolean hasSourcePicoseconds
Definition: open62541.h:1572
struct UA_DiagnosticInfo * innerDiagnosticInfo
Definition: open62541.h:1601
AddNodesRequest ^^^^^^^^^^^^^^^ Adds one or more nodes to the server address space.
Definition: open62541.h:4988
#define UA_LOG_DEBUG_SESSION(LOGGER, SESSION, MSG,...)
Definition: open62541.c:3780
#define UA_TYPES_CREATESUBSCRIPTIONREQUEST
Definition: open62541.h:4237
#define UA_NS0ID_VIEWSFOLDER
Definition: open62541.h:1865
#define UA_TYPES_CALLMETHODRESULT
Definition: open62541.h:3453
UA_AsymmetricAlgorithmSecurityHeader clientAsymAlgSettings
Definition: open62541.c:3236
#define UA_TYPES_PUBLISHRESPONSE
Definition: open62541.h:4006
UA_QualifiedName browseName
Definition: open62541.h:4575
RequestHeader ^^^^^^^^^^^^^ The header passed with every server request.
Definition: open62541.h:3300
UA_SecurityTokenRequestType requestType
Definition: open62541.h:4291
#define ADDPROFILEARRAY(x)
UA_StatusCode UA_Subscription_deleteMonitoredItem(UA_Server *server, UA_Subscription *sub, UA_UInt32 monitoredItemID)
UA_UInt32 protocolVersion
Definition: open62541.c:2549
Definition: open62541.c:3215
#define UA_TYPES_RELATIVEPATH
Definition: open62541.h:4662
UA_StatusCode UA_SecureChannelManager_open(UA_SecureChannelManager *cm, UA_Connection *conn, const UA_OpenSecureChannelRequest *request, UA_OpenSecureChannelResponse *response)
Definition: open62541.c:18712
#define UA_NS0ID_GENERATESEVENT
Definition: open62541.h:1836
#define UA_NS0ID_GETENDPOINTSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2026
UA_UInt32 maxMessageSize
Definition: open62541.h:9453
#define UA_TYPES_BROWSERESPONSE
Definition: open62541.h:5145
#define UA_TYPES_FINDSERVERSRESPONSE
Definition: open62541.h:4939
#define UA_STATUSCODE_BADTIMEOUT
Definition: open62541.h:663
UA_UInt16 namespaceIndex
Definition: open62541.h:1288
#define FNV_PRIME_32
Definition: open62541.c:5041
#define UA_TYPES_MODIFYSUBSCRIPTIONREQUEST
Definition: open62541.h:4336
AddNodesResponse ^^^^^^^^^^^^^^^^ Adds one or more nodes to the server address space.
Definition: open62541.h:4491
#define UA_STATUSCODE_BADNOVALIDCERTIFICATES
Definition: open62541.h:749
#define UA_TYPES_SBYTE
SByte ^^^^^.
Definition: open62541.h:3097
#define errno__
Definition: open62541.c:26765
struct channel_list_entry channel_list_entry
#define UA_TYPES_ADDNODESITEM
Definition: open62541.h:4823
void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session, const UA_DeleteMonitoredItemsRequest *request, UA_DeleteMonitoredItemsResponse *response)
SetPublishingModeRequest ^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3562
const UA_Guid UA_GUID_NULL
Definition: open62541.c:4783
#define UA_STATUSCODE_BADMONITOREDITEMFILTERUNSUPPORTED
Definition: open62541.h:723
UA_StatusCode * results
Definition: open62541.h:4713
#define UA_TYPES_DELETENODESRESPONSE
Definition: open62541.h:4718
UA_BrowseResult UA_Server_browse(UA_Server *server, UA_UInt32 maxrefs, const UA_BrowseDescription *descr)
Browsing
Definition: open62541.c:22902
UA_Double requestedPublishingInterval
Definition: open62541.h:4229
#define TAILQ_LAST(head, headname)
Definition: open62541.c:453
UA_StatusCode readValueAttribute(UA_Server *server, const UA_VariableNode *vn, UA_DataValue *v)
Definition: open62541.c:20519
#define UA_STATUSCODE_BADREQUESTCANCELLEDBYREQUEST
Definition: open62541.h:751
void UA_NodeStore_deleteNode(UA_Node *node)
Definition: open62541.c:19373
#define UA_NS0ID_SERVERCAPABILITIESTYPE
Definition: open62541.h:2489
const UA_DataType * type
Definition: open62541.h:1400
RegisterNodesResponse ^^^^^^^^^^^^^^^^^^^^^ Registers one or more nodes for repeated use within a ses...
Definition: open62541.h:4303
UA_ResponseHeader responseHeader
Definition: open62541.h:3994
int64_t UA_DateTime
Definition: open62541.h:1070
UA_Int32 sockfd
Definition: open62541.h:9484
UA_MonitoredItemModifyResult * results
Definition: open62541.h:4762
DeleteMonitoredItemsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3941
UA_StatusCode writeValueAttribute(UA_Server *server, UA_VariableNode *node, const UA_DataValue *value, const UA_String *indexRange)
Definition: open62541.c:20568
#define UA_TYPES_CONTENTFILTER
Definition: open62541.h:4964
#define UA_TRANSPORT_MESSAGETYPE
Definition: open62541.c:2585
UA_UInt32 secondsTillShutdown
Definition: open62541.h:4834
#define UA_NS0ID_PUBLISHREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2418
#define UA_TYPES_ARGUMENT
Definition: open62541.h:3720
#define TAILQ_INSERT_HEAD(head, elm, field)
Definition: open62541.c:492
UA_Int16 i16
Definition: open62541.c:776
UA_Node node
Definition: open62541.c:19166
void UA_Array_delete(void *p, size_t size, const UA_DataType *type)
Definition: open62541.c:5809
#define UA_STATUSCODE_BADNOTCONNECTED
Definition: open62541.h:810
#define UA_TYPES_ADDREFERENCESITEM
Definition: open62541.h:4623
#define UA_STATUSCODE_BADSERVERHALTED
Definition: open62541.h:667
ContentFilterResult ^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4601
UA_Client * client
Definition: open62541.c:25349
UA_SByte i8
Definition: open62541.c:774
ReferenceNode ^^^^^^^^^^^^^ Specifies a reference which belongs to a node.
Definition: open62541.h:3699
#define UA_TYPES_MESSAGESECURITYMODE
Definition: open62541.h:3668
UA_DataChangeTrigger trigger
Definition: open62541.h:4873
UA_EndpointDescription * endpoints
Definition: open62541.h:5089
UA_String sessionName
Definition: open62541.c:3728
UA_ByteString clientNonce
Definition: open62541.c:3238
UA_AddReferencesItem * referencesToAdd
Definition: open62541.h:4790
#define UA_STATUSCODE_BADREQUESTTIMEOUT
Definition: open62541.h:804
UA_UInt16 memSize
Definition: open62541.h:1655
UA_Boolean includeSubtypes
Definition: open62541.h:3476
#define UA_NS0ID_HASCOMPONENT
Definition: open62541.h:1840
Definition: open62541.c:4062
#define UA_STATUSCODE_BADOUTOFRANGE
Definition: open62541.h:715
#define UA_STATUSCODE_BADQUERYTOOCOMPLEX
Definition: open62541.h:778
size_t length
Definition: open62541.h:1039
UA_UInt32 retransmitSequenceNumber
Definition: open62541.h:4455
UA_ExpandedNodeId typeDefinition
Definition: open62541.h:4820
#define UA_STATUSCODE_BADHISTORYOPERATIONINVALID
Definition: open62541.h:782
UA_StatusCode Subscription_registerPublishJob(UA_Server *server, UA_Subscription *sub)
ReadRequest ^^^^^^^^^^^.
Definition: open62541.h:4799
UA_MonitoringParameters requestedParameters
Definition: open62541.h:4738
GetEndpointsResponse ^^^^^^^^^^^^^^^^^^^^ Gets the endpoints used by the server.
Definition: open62541.h:5086
#define UA_STATUSCODE_BADREFRESHINPROGRESS
Definition: open62541.h:823
UA_UInt16 data2
Definition: open62541.h:1109
UA_ApplicationDescription * servers
Definition: open62541.h:4936
#define UA_TYPES_ADDNODESREQUEST
Definition: open62541.h:4994
UA_ChannelSecurityToken securityToken
Definition: open62541.c:3234
#define UA_TYPES_CREATESESSIONRESPONSE
Definition: open62541.h:5166
CallResponse ^^^^^^^^^^^^.
Definition: open62541.h:4696
uint64_t UA_UInt64
UInt64 ^^^^^^ An integer value between 0 and 18 446 744 073 709 551 615.
Definition: open62541.h:987
#define UA_TYPES_DELETEREFERENCESRESPONSE
Definition: open62541.h:4676
#define UA_STATUSCODE_BADFILTERELEMENTINVALID
Definition: open62541.h:732
#define UA_NODEIDTYPE_NUMERIC_TWOBYTE
Definition: open62541.c:6455
#define TAILQ_ENTRY(type)
Definition: open62541.c:441
UA_StatusCode UA_Server_setVariableNode_dataSource(UA_Server *server, const UA_NodeId nodeId, const UA_DataSource dataSource)
Definition: open62541.c:22554
#define UA_STATUSCODE_BADDIALOGRESPONSEINVALID
Definition: open62541.h:830
#define DAYS_PER_400Y
Definition: open62541.c:26305
UA_StatusCode(* UA_exchangeEncodeBuffer)(void *handle, UA_ByteString *buf, size_t offset)
Definition: open62541.c:853
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTURI
Definition: open62541.h:2546
SecureConversationMessageAbortBody ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Secure Conversation Message Abo...
Definition: open62541.c:2525
SetMonitoringModeRequest ^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4386
void() UA_ProcessMessageCallback(void *application, UA_SecureChannel *channel, UA_MessageType messageType, UA_UInt32 requestId, const UA_ByteString *message)
Chunking
Definition: open62541.c:3265
#define DOUBLE_NEG_ZERO
Definition: open62541.c:6211
#define UA_STATUSCODE_BADMONITOREDITEMIDINVALID
Definition: open62541.h:721
#define UA_STATUSCODE_BADAGGREGATECONFIGURATIONREJECTED
Definition: open62541.h:852
UA_Boolean activated
Definition: open62541.c:3727
#define UA_TYPES_FLOAT
Float ^^^^^.
Definition: open62541.h:3145
#define UA_STATUSCODE_BADTOOMANYSESSIONS
Definition: open62541.h:746
#define UA_STATUSCODE_BADIDENTITYCHANGENOTSUPPORTED
Definition: open62541.h:750
#define UA_INT64_MAX
Definition: open62541.h:981
UA_Boolean containsNoLoops
Definition: open62541.h:3269
void Service_OpenSecureChannel(UA_Server *server, UA_Connection *connection, const UA_OpenSecureChannelRequest *request, UA_OpenSecureChannelResponse *response)
SecureChannel Service Set This Service Set defines Services used to open a communication channel that...
Definition: open62541.c:19851
#define UA_TYPES_REPUBLISHRESPONSE
Definition: open62541.h:4729
UA_StatusCode * results
Definition: open62541.h:4203
#define UA_free(_p_ptr)
UA_Boolean deleteBidirectional
Definition: open62541.h:3623
UA_DateTime timestamp
Definition: open62541.h:3902
UA_DateTime sourceTimestamp
Definition: open62541.h:1576
size_t(* getJobs)(UA_ServerNetworkLayer *nl, UA_Job **jobs, UA_UInt16 timeout)
Definition: open62541.h:9786
UA_DateTime nextChannelRenewal
Definition: open62541.c:4743
#define UA_TYPES_MONITOREDITEMMODIFYREQUEST
Definition: open62541.h:4017
UA_NodeId authenticationToken
Definition: open62541.h:5154
#define UA_LOG_INFO_CHANNEL(LOGGER, CHANNEL, MSG,...)
Definition: open62541.c:3286
#define UA_NS0ID_SERVER_GETMONITOREDITEMS_OUTPUTARGUMENTS
Definition: open62541.h:2771
void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server *server)
Definition: open62541.c:15647
#define UA_STATUSCODE_GOODNONCRITICALTIMEOUT
Definition: open62541.h:865
DeleteNodesRequest ^^^^^^^^^^^^^^^^^^ Delete one or more nodes from the server address space...
Definition: open62541.h:3981
#define UA_TYPES_READRESPONSE
Definition: open62541.h:4781
#define UA_STATUSCODE_BADNOTSUPPORTED
Definition: open62541.h:716
ContentFilter ^^^^^^^^^^^^^.
Definition: open62541.h:4959
UA_Variant * inputArguments
Definition: open62541.h:3504
UA_Server * UA_Server_new(const UA_ServerConfig config)
Definition: open62541.c:16135
#define UA_LOG_WARNING_SESSION(LOGGER, SESSION, MSG,...)
Definition: open62541.c:3794
SetPublishingModeResponse ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4587
status(* UA_decodeBinarySignature)(void *UA_RESTRICT dst, const UA_DataType *type)
Definition: open62541.c:5868
UA_String reason
Definition: open62541.c:2565
UA_MessageSecurityMode securityMode
Definition: open62541.h:5072
#define UA_NODESTORE_TOMBSTONE
Definition: open62541.c:19169
#define UA_STATUSCODE_BADNODEIDEXISTS
Definition: open62541.h:755
#define UA_TYPES_MONITOREDITEMCREATEREQUEST
Definition: open62541.h:4741
#define UA_STATUSCODE_UNCERTAINSENSORNOTACCURATE
Definition: open62541.h:819
const UA_decodeBinarySignature decodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT+1]
Definition: open62541.c:7264
#define UA_NS0ID_WRITEREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2271
#define UA_NS0ID_SERVER
Definition: open62541.h:2537
UA_EndpointDescription * endpointDescriptions
Definition: open62541.c:4213
UA_MonitoringParameters requestedParameters
Definition: open62541.h:4014
UA_ResponseHeader responseHeader
Definition: open62541.h:4644
#define UA_STATUSCODE_BADINVALIDTIMESTAMPARGUMENT
Definition: open62541.h:784
BuildInfo ^^^^^^^^^.
Definition: open62541.h:3792
#define UA_NS0ID_FLOAT
Definition: open62541.h:1805
UA_UInt32 resultMask
Definition: open62541.h:4443
UA_StatusCode UA_Client_writeArrayDimensionsAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_UInt32 *newArrayDimensions, size_t newArrayDimensionsSize)
Definition: open62541.c:25812
UA_ResponseHeader responseHeader
Definition: open62541.h:4145
QueryDataSet ^^^^^^^^^^^^.
Definition: open62541.h:3539
#define UA_TYPES_READREQUEST
Definition: open62541.h:4807
#define USERNAME_POLICY
Definition: open62541.c:4156
void UA_NodeStore_iterate(UA_NodeStore *ns, UA_NodeStore_nodeVisitor visitor)
Definition: open62541.c:19476
const UA_EXPORT UA_ClientConfig UA_ClientConfig_standard
Definition: open62541.c:27654
#define UA_STATUSCODE_BADAGGREGATELISTMISMATCH
Definition: open62541.h:849
#define UA_STATUSCODE_BADOPERATIONABANDONED
Definition: open62541.h:874
void UA_SecureChannel_init(UA_SecureChannel *channel)
Definition: open62541.c:15164
#define UA_TYPES_USERNAMEIDENTITYTOKEN
Definition: open62541.h:4030
UA_StatusCode __UA_Server_write(UA_Server *server, const UA_NodeId *nodeId, const UA_AttributeId attributeId, const UA_DataType *attr_type, const void *attr)
Definition: open62541.c:21180
#define SLIST_INSERT_HEAD(head, elm, field)
Definition: open62541.c:167
UA_ObjectLifecycleManagement lifecycleManagement
Definition: open62541.c:3545
#define UA_TYPES_BROWSEREQUEST
Definition: open62541.h:5008
#define UA_STATUSCODE_BADREFERENCELOCALONLY
Definition: open62541.h:765
#define UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED
Definition: open62541.h:659
UA_Boolean final
Definition: open62541.c:3228
#define UA_EXPANDEDNODEID_SERVERINDEX_FLAG
Definition: open62541.c:6459
void Service_Call(UA_Server *server, UA_Session *session, const UA_CallRequest *request, UA_CallResponse *response)
void UA_SessionManager_cleanupTimedOut(UA_SessionManager *sm, UA_DateTime nowMonotonic)
Definition: open62541.c:18868
UA_UInt32 requestedMaxReferencesPerNode
Definition: open62541.h:5003
ReferenceTypeAttributes ^^^^^^^^^^^^^^^^^^^^^^^ The attributes for a reference type node...
Definition: open62541.h:4369
#define UA_STATUSCODE_BADTOOMANYOPERATIONS
Definition: open62541.h:669
DeleteNodesResponse ^^^^^^^^^^^^^^^^^^^ Delete one or more nodes from the server address space...
Definition: open62541.h:4710
#define UA_STATUSCODE_GOODDEPENDENTVALUECHANGED
Definition: open62541.h:858
UA_NodeClass targetNodeClass
Definition: open62541.h:4620
UA_ExpandedNodeId typeDefinition
Definition: open62541.h:4578
#define TAILQ_INIT(head)
Definition: open62541.c:487
#define UA_NS0ID_SERVER_SERVERREDUNDANCY_REDUNDANCYSUPPORT
Definition: open62541.h:2662
UA_Connection * connection
Definition: open62541.c:3242
UA_ResponseHeader responseHeader
Definition: open62541.h:5112
#define UA_NS0ID_SBYTE
Definition: open62541.h:1797
TranslateBrowsePathsToNodeIdsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Translates one or more pa...
Definition: open62541.h:4858
#define UA_LOG_DEBUG_CHANNEL(LOGGER, CHANNEL, MSG,...)
Definition: open62541.c:3281
UA_UInt16 nanoSec
Definition: open62541.h:1088
UA_Connection UA_ClientConnectionTCP(UA_ConnectionConfig conf, const char *endpointUrl, UA_Logger logger)
Definition: open62541.c:27331
UA_Node * UA_NodeStore_newNode(UA_NodeClass nodeClass)
Node Lifecycle ^^^^^^^^^^^^^^.
Definition: open62541.c:19365
#define UA_NS0ID_DATATYPESFOLDER
Definition: open62541.h:1868
UA_String password
Definition: open62541.c:4748
UA_Boolean isNodeInTree(UA_NodeStore *ns, const UA_NodeId *leafNode, const UA_NodeId *nodeToFind, const UA_NodeId *referenceTypeIds, size_t referenceTypeIdsSize)
Definition: open62541.c:17802
#define UA_STATUSCODE_BADMESSAGENOTAVAILABLE
Definition: open62541.h:793
#define APPLICATION_URI
Definition: open62541.c:27580
#define UA_TYPES_ADDNODESRESPONSE
Definition: open62541.h:4499
void Service_Publish(UA_Server *server, UA_Session *session, const UA_PublishRequest *request, UA_UInt32 requestId)
UA_StatusCode UA_Variant_setRangeCopy(UA_Variant *v, const void *array, size_t arraySize, const UA_NumericRange range)
Definition: open62541.c:5501
#define UA_TYPES_PARSINGRESULT
Definition: open62541.h:3467
#define UA_PRINTF_GUID_DATA(GUID)
Definition: open62541.h:9727
#define INTERRUPTED
Definition: open62541.c:26766
#define UA_NS0ID_STRING
Definition: open62541.h:1807
#define UA_NS0ID_UINT64
Definition: open62541.h:1804
UA_UInt32 messageType
Definition: open62541.c:3225
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MINSUPPORTEDSAMPLERATE
Definition: open62541.h:2555
void UA_SecureChannelManager_deleteMembers(UA_SecureChannelManager *cm)
Definition: open62541.c:18644
#define UA_ASSERT_RCU_UNLOCKED()
Definition: open62541.c:4189
#define UA_SEC_TO_DATETIME
Definition: open62541.h:1075
void(* UA_ServerCallback)(UA_Server *server, void *data)
Definition: open62541.h:9574
UA_UInt32 maxResponseMessageSize
Definition: open62541.h:5047
UA_UInt16 nThreads
Definition: open62541.h:9822
UA_StatusCode UA_Server_run_startup(UA_Server *server)
Definition: open62541.c:18449
UA_UInt16 u16
Definition: open62541.c:775
ViewDescription ^^^^^^^^^^^^^^^ The view to browse.
Definition: open62541.h:3929
#define UA_NS0ID_REFERENCES
Definition: open62541.h:1826
#define UA_NS0ID_DELETENODESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2098
#define UA_STATUSCODE_BADREQUESTINTERRUPTED
Definition: open62541.h:803
void(* UA_NodeStore_nodeVisitor)(const UA_Node *node)
Iteration ^^^^^^^^^ The following definitions are used to call a callback for every node in the nodes...
Definition: open62541.c:4046
#define UA_TYPES_STRING
String ^^^^^^.
Definition: open62541.h:3157
uint32_t pcg32_random_r(pcg32_random_t *rng)
Definition: open62541.c:26415
RepublishResponse ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4724
#define UA_NS0ID_LOCALIZEDTEXT
Definition: open62541.h:1816
UA_NodeId nodeId
Definition: open62541.h:3852
CreateSubscriptionResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4629
BrowseResponse ^^^^^^^^^^^^^^ Browse the references for one or more nodes from the server address spa...
Definition: open62541.h:5137
UA_UInt32 requestHandle
Definition: open62541.c:4753
float UA_Float
Float ^^^^^ An IEEE single precision (32 bit) floating point value.
Definition: open62541.h:995
#define UA_NS0ID_HASMODELPARENT
Definition: open62541.h:3066
UA_Boolean hasServerTimestamp
Definition: open62541.h:1571
Definition: open62541.c:4104
UA_UInt16 hour
Definition: open62541.h:1093
UA_NodeStoreEntry ** entries
Definition: open62541.c:19172
UA_UInt32 requestId
Definition: open62541.c:4742
UA_DateTime startTime
Definition: open62541.c:4211
UA_UInt32 sequenceNumber
Definition: open62541.h:3374
#define UA_STATUSCODE_BADNOTFOUND
Definition: open62541.h:717
UA_ResponseHeader responseHeader
Definition: open62541.h:4492
UA_LocalizedText description
Definition: open62541.h:3353
UA_Boolean hasValue
Definition: open62541.h:1568
UA_SecureChannel * UA_SecureChannelManager_get(UA_SecureChannelManager *cm, UA_UInt32 channelId)
Definition: open62541.c:18793
#define UA_STATUSCODE_BADSERVERNAMEMISSING
Definition: open62541.h:740
#define UA_STATUSCODE_BADDATAUNAVAILABLE
Definition: open62541.h:840
UA_UInt32 sendBufferSize
Definition: open62541.c:2551
void Service_Browse(UA_Server *server, UA_Session *session, const UA_BrowseRequest *request, UA_BrowseResponse *response)
Definition: open62541.c:22873
UA_Session * UA_SessionManager_getSession(UA_SessionManager *sm, const UA_NodeId *token)
Definition: open62541.c:18882
#define UA_NS0ID_XMLELEMENT
Definition: open62541.h:1811
void __UA_Client_Service(UA_Client *client, const void *request, const UA_DataType *requestType, void *response, const UA_DataType *responseType)
Definition: open62541.c:25434
UA_StatusCode UA_decodeBinary(const UA_ByteString *src, size_t *offset, void *dst, const UA_DataType *type) UA_FUNC_ATTR_WARN_UNUSED_RESULT
Definition: open62541.c:7320
UA_String UA_DateTime_toString(UA_DateTime t)
Definition: open62541.c:4885
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDNUMBER
Definition: open62541.h:2549
#define UA_NS0ID_SERVERDIAGNOSTICSTYPE
Definition: open62541.h:2490
#define UA_NS0ID_DELETEREFERENCESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2104
UA_UInt64 u64
Definition: open62541.c:779
#define ANONYMOUS_POLICY
Definition: open62541.c:4155
void MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem)
#define UA_TYPES_BROWSENEXTREQUEST
Definition: open62541.h:4221
#define VERSION(MAJOR, MINOR, PATCH, LABEL)
Definition: open62541.c:27586
void UA_Log_Stdout(UA_LogLevel level, UA_LogCategory category, const char *msg, va_list args)
Definition: open62541.c:27533
UA_ResponseHeader responseHeader
Definition: open62541.h:4760
UA_MessageSecurityMode securityMode
Definition: open62541.c:3233
void UA_Connection_deleteMembers(UA_Connection *connection)
Definition: open62541.c:14868
UA_StatusCode UA_EndpointUrl_split_ptr(const char *endpointUrl, char *hostname, const char **port, const char **path)
Definition: open62541.c:15022
void Service_CreateSubscription(UA_Server *server, UA_Session *session, const UA_CreateSubscriptionRequest *request, UA_CreateSubscriptionResponse *response)
Subscription Service Set Subscriptions are used to report Notifications to the Client.
UA_UInt32 subscriptionId
Definition: open62541.h:3995
#define UA_LOG_TRACE_CHANNEL(LOGGER, CHANNEL, MSG,...)
Log Helper
Definition: open62541.c:3276
#define UA_STATUSCODE_BADEXPECTEDSTREAMTOBLOCK
Definition: open62541.h:875
#define UA_STATUSCODE_BADSTRUCTUREMISSING
Definition: open62541.h:725
UA_StatusCode __UA_Client_writeAttribute(UA_Client *client, const UA_NodeId *nodeId, UA_AttributeId attributeId, const void *in, const UA_DataType *inDataType)
Definition: open62541.c:25776
#define UA_NS0ID_HASEFFECT
Definition: open62541.h:1846
void Service_CreateMonitoredItems(UA_Server *server, UA_Session *session, const UA_CreateMonitoredItemsRequest *request, UA_CreateMonitoredItemsResponse *response)
MonitoredItem Service Set Clients define MonitoredItems to subscribe to data and Events.
UA_DeleteReferencesItem * referencesToDelete
Definition: open62541.h:4750
void Service_Read(UA_Server *server, UA_Session *session, const UA_ReadRequest *request, UA_ReadResponse *response)
Query Service Set This Service Set is used to issue a Query to a Server.
Definition: open62541.c:20861
UA_Boolean discardOldest
Definition: open62541.h:3679
#define UA_TYPES_WRITEVALUE
Definition: open62541.h:3639
#define UA_SECURE_MESSAGE_HEADER_LENGTH
Definition: open62541.c:15162
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDDATE
Definition: open62541.h:2550
ObjectTypeAttributes ^^^^^^^^^^^^^^^^^^^^ The attributes for an object type node. ...
Definition: open62541.h:3736
UA_ExtensionObject userIdentityToken
Definition: open62541.h:4074
UA_StatusCode UA_Server_deleteReference(UA_Server *server, const UA_NodeId sourceNodeId, const UA_NodeId referenceTypeId, UA_Boolean isForward, const UA_ExpandedNodeId targetNodeId, UA_Boolean deleteBidirectional)
Definition: open62541.c:22498
UA_Boolean UA_String_equal(const UA_String *s1, const UA_String *s2)
Definition: open62541.c:4839
UserTokenPolicy ^^^^^^^^^^^^^^^ Describes a user token that can be used with a server.
Definition: open62541.h:4342
UA_ResponseHeader responseHeader
Definition: open62541.h:4697
UA_Boolean hasInnerDiagnosticInfo
Definition: open62541.h:1594
#define UA_STATUSCODE_BADENTRYEXISTS
Definition: open62541.h:841
#define CHECK_DATATYPE_SCALAR(EXP_DT)
Definition: open62541.c:21000
#define UA_STATUSCODE_BADVIEWVERSIONINVALID
Definition: open62541.h:772
struct UA_DelayedJob UA_DelayedJob
UA_StatusCode * results
Definition: open62541.h:4671
#define UA_NS0ID_HASSUBTYPE
Definition: open62541.h:1838
UA_BrowseResultMask
BrowseResultMask ^^^^^^^^^^^^^^^^ A bit mask which specifies what should be returned in a browse resp...
Definition: open62541.h:3279
#define UA_TYPES_USERTOKENTYPE
Definition: open62541.h:4061
UA_RequestHeader requestHeader
Definition: open62541.h:4465
#define UA_TYPES_ADDREFERENCESRESPONSE
Definition: open62541.h:4852
void(* deleteMembers)(UA_ServerNetworkLayer *nl)
Deletes the network content.
Definition: open62541.h:9799
UA_NodeId sessionId
Definition: open62541.c:3730
UA_StatusCode UA_Client_readArrayDimensionsAttribute(UA_Client *client, const UA_NodeId nodeId, UA_UInt32 **outArrayDimensions, size_t *outArrayDimensionsSize)
Definition: open62541.c:25905
UA_ValueSource
VariableNode
Definition: open62541.c:3438
UA_UInt32 messageSize
Definition: open62541.c:2630
UA_NodeId viewId
Definition: open62541.h:3930
#define UA_TYPES_CLOSESESSIONREQUEST
Definition: open62541.h:4320
#define UA_TYPES_DELETESUBSCRIPTIONSRESPONSE
Definition: open62541.h:4651
UA_ClientState state
Definition: open62541.c:4733
UA_UInt16 year
Definition: open62541.h:1096
UA_UInt32 protocolVersion
Definition: open62541.h:9450
UA_UserTokenPolicy token
Definition: open62541.c:4751
UA_UInt32 subscriptionId
Definition: open62541.h:4454
UA_ResponseHeader responseHeader
Definition: open62541.h:4845
void Service_Call_single(UA_Server *server, UA_Session *session, const UA_CallMethodRequest *request, UA_CallMethodResult *result)
UA_UInt16 UA_Server_run_iterate(UA_Server *server, UA_Boolean waitInternal)
Definition: open62541.c:18510
#define UA_NS0ID_ADDNODESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2086
void * UA_new(const UA_DataType *type)
The following functions are used for generic handling of data types.
Definition: open62541.c:5577
UA_UInt32 requestedMaxKeepAliveCount
Definition: open62541.h:4231
#define UA_STATUSCODE_BADSECURECHANNELTOKENUNKNOWN
Definition: open62541.h:806
#define UA_STATUSCODE_BADSERVERURIINVALID
Definition: open62541.h:739
#define UA_NS0ID_DATAVALUE
Definition: open62541.h:1818
FindServersResponse ^^^^^^^^^^^^^^^^^^^ Finds the servers known to the discovery server.
Definition: open62541.h:4933
UA_StatusCode UA_Server_setVariableNode_valueCallback(UA_Server *server, const UA_NodeId nodeId, const UA_ValueCallback callback)
Definition: open62541.c:22528
#define UA_STATUSCODE_BADNODENOTINVIEW
Definition: open62541.h:738
UA_StatusCode __UA_Server_addNode(UA_Server *server, const UA_NodeClass nodeClass, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, const UA_QualifiedName browseName, const UA_NodeId typeDefinition, const UA_NodeAttributes *attr, const UA_DataType *attributeType, UA_InstantiationCallback *instantiationCallback, UA_NodeId *outNewNodeId)
Definition: open62541.c:22036
size_t outputArgumentsSize
Definition: open62541.h:3449
CloseSessionResponse ^^^^^^^^^^^^^^^^^^^^ Closes a session with the server.
Definition: open62541.h:4896
#define UA_TYPES_FINDSERVERSREQUEST
Definition: open62541.h:4565
#define UA_NS0ID_TOSTATE
Definition: open62541.h:1844
UA_StatusCode UA_Server_run(UA_Server *server, volatile UA_Boolean *running)
Definition: open62541.c:18615
#define MANUFACTURER_NAME
Definition: open62541.c:27576
UA_UInt32 maxResponseMessageSize
Definition: open62541.c:3732
UA_NodeId addedNodeId
Definition: open62541.h:3341
UA_DateTime serverTimestamp
Definition: open62541.h:1578
UA_NODE_BASEATTRIBUTES UA_Byte eventNotifier
Definition: open62541.c:3525
UA_String UA_XmlElement
XmlElement ^^^^^^^^^^ An XML element.
Definition: open62541.h:1154
NodeAttributes ^^^^^^^^^^^^^^ The base attributes for all nodes.
Definition: open62541.h:3955
NotificationMessage ^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3373
UA_ExpandedNodeId parentNodeId
Definition: open62541.h:4814
#define UA_TYPES_REPUBLISHREQUEST
Definition: open62541.h:4458
#define SOCKET
Definition: open62541.c:26719
#define UA_STATUSCODE_BADSECURECHANNELIDINVALID
Definition: open62541.h:689
UA_UInt32 userWriteMask
Definition: open62541.h:3355
#define UA_USEC_TO_DATETIME
Definition: open62541.h:1073
#define UA_NS0ID_PROPERTYTYPE
Definition: open62541.h:1852
UA_UInt16 availableContinuationPoints
Definition: open62541.c:3736
void Service_CloseSession(UA_Server *server, UA_Session *session, const UA_CloseSessionRequest *request, UA_CloseSessionResponse *response)
Definition: open62541.c:20037
#define UA_TYPES_BROWSEPATHRESULT
Definition: open62541.h:4269
#define UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER
Definition: open62541.c:2657
#define UA_NS0ID_HASTYPEDEFINITION
Definition: open62541.h:1835
#define UA_MINMESSAGESIZE
Definition: open62541.c:24741
#define UA_PRINTF_STRING_DATA(STRING)
Definition: open62541.h:9732
#define UA_NS0ID_HIERARCHICALREFERENCES
Definition: open62541.h:1828
UA_BrowsePathTarget * targets
Definition: open62541.h:4266
Networking Client-server connection is represented by a UA_Connection structure.
Definition: open62541.h:9449
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO
Definition: open62541.h:2544
#define UA_NS0ID_TYPESFOLDER
Definition: open62541.h:1864
#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_ENABLEDFLAG
Definition: open62541.h:2571
UA_WriteValue * nodesToWrite
Definition: open62541.h:4413
#define UA_TYPES_DELETENODESITEM
Definition: open62541.h:3856
UA_DataValue UA_Server_read(UA_Server *server, const UA_ReadValueId *item, UA_TimestampsToReturn timestamps)
Reading and Writing Node Attributes The functions for reading and writing node attributes call the re...
Definition: open62541.c:20937
UA_NodeId startingNode
Definition: open62541.h:5015
#define UA_STATUSCODE_BADTOOMANYARGUMENTS
Definition: open62541.h:699
UA_UInt32 attributeId
Definition: open62541.h:3875
#define UA_NS0ID_CREATESUBSCRIPTIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2385
DataChangeFilter ^^^^^^^^^^^^^^^^.
Definition: open62541.h:4872
UA_MonitoredItemCreateRequest * itemsToCreate
Definition: open62541.h:4950
UA_ClientConfig config
Definition: open62541.c:4734
#define UA_STATUSCODE_BADBOUNDNOTFOUND
Definition: open62541.h:837
MethodAttributes ^^^^^^^^^^^^^^^^ The attributes for a method node.
Definition: open62541.h:3602
UnregisterNodesRequest ^^^^^^^^^^^^^^^^^^^^^^ Unregisters one or more previously registered nodes...
Definition: open62541.h:3513
#define UA_NS0ID_BYTESTRING
Definition: open62541.h:1810
UA_NodeClass nodeClass
Definition: open62541.h:4577
#define UA_STATUSCODE_BADNOCOMMUNICATION
Definition: open62541.h:704
UA_ByteString byteString
Definition: open62541.h:1178
#define UA_TYPES_SERVERSTATUSDATATYPE
Definition: open62541.h:4838
#define UA_STATUSCODE_BADTIMESTAMPSTORETURNINVALID
Definition: open62541.h:697
#define UA_NS0ID_DOUBLE
Definition: open62541.h:1806
#define UA_TYPES_DATACHANGENOTIFICATION
Definition: open62541.h:4512
#define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_TEXT
Definition: open62541.c:6634
#define UA_STRING_STATIC_NULL
Definition: open62541.c:27583
#define UA_STATUSCODE_BADINVALIDARGUMENT
Definition: open62541.h:866
void Service_SetMonitoringMode(UA_Server *server, UA_Session *session, const UA_SetMonitoringModeRequest *request, UA_SetMonitoringModeResponse *response)
void Service_FindServers(UA_Server *server, UA_Session *session, const UA_FindServersRequest *request, UA_FindServersResponse *response)
Discovery Service Set This Service Set defines Services used to discover the Endpoints implemented by...
Definition: open62541.c:19727
#define UA_STATUSCODE_GOODPOSTACTIONFAILED
Definition: open62541.h:856
#define UA_STATUSCODE_UNCERTAINSUBNORMAL
Definition: open62541.h:821
UA_StatusCode(* start)(UA_ServerNetworkLayer *nl, UA_Logger logger)
Definition: open62541.h:9774
#define UA_fd_isset(fd, fds)
Definition: open62541.c:26749
UA_NumericRangeDimension * dimensions
Definition: open62541.h:1348
UA_ResponseHeader responseHeader
Definition: open62541.h:4897
#define UA_STATUSCODE_GOODCOMMUNICATIONEVENT
Definition: open62541.h:862
const UA_calcSizeBinarySignature calcSizeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT+1]
Definition: open62541.c:7534
#define UA_NODESTORE_MINSIZE
Definition: open62541.c:19162
#define UA_NS0ID_NODEID
Definition: open62541.h:1812
UA_StatusCode statusCode
Definition: open62541.h:3444
#define UA_STATUSCODE_BADOBJECTDELETED
Definition: open62541.h:718
UA_Boolean hasNamespaceUri
Definition: open62541.h:1589
#define UA_STATUSCODE_BADTCPENDPOINTURLINVALID
Definition: open62541.h:802
UA_DateTime validTill
Definition: open62541.c:3734
union UA_ExtensionObject::@1 content
UA_StatusCode * results
Definition: open62541.h:4001
UA_SubscriptionState
Definition: open62541.c:3885
UA_ApplicationDescription server
Definition: open62541.h:5070
UA_NodeId nodeId
Definition: open62541.h:3633
#define UA_STATUSCODE_GOODSHUTDOWNEVENT
Definition: open62541.h:863
#define UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE
Definition: open62541.h:4866
#define UA_STATUSCODE_BADSECURITYMODEREJECTED
Definition: open62541.h:744
#define UA_NS0ID_SERVER_SERVERSTATUS_SHUTDOWNREASON
Definition: open62541.h:2634
UA_Boolean deleteTargetReferences
Definition: open62541.h:3853
UA_NodeId sourceNodeId
Definition: open62541.h:4615
#define UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER
Definition: open62541.c:2597
TcpHelloMessage ^^^^^^^^^^^^^^^ Hello Message.
Definition: open62541.c:2548
#define UA_STATUSCODE_BADNODECLASSINVALID
Definition: open62541.h:756
UA_Subscription * UA_Subscription_new(UA_Session *session, UA_UInt32 subscriptionID)
ChannelSecurityToken ^^^^^^^^^^^^^^^^^^^^ The token that identifies a set of keys for an active secur...
Definition: open62541.h:3827
UA_Client_Authentication authenticationMethod
Definition: open62541.c:4746
#define UA_TYPES_NODEATTRIBUTES
Definition: open62541.h:3963
#define UA_TYPES_MODIFYMONITOREDITEMSRESPONSE
Definition: open62541.h:4767
#define UA_TYPES_DEADBANDTYPE
Definition: open62541.h:3759
UA_UInt16 month
Definition: open62541.h:1095
Server Configuration The following structure is passed to a new server for configuration.
Definition: open62541.h:9806
#define UA_TYPES_REFERENCETYPEATTRIBUTES
Definition: open62541.h:4380
#define UA_STATUSCODE_BADCERTIFICATEREVOKED
Definition: open62541.h:683
#define UA_NS0ID_CREATEMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2349
UA_UInt32 writeMask
Definition: open62541.h:3959
#define UA_STATUSCODE_BADNOMATCH
Definition: open62541.h:779
#define UA_STATUSCODE_GOODEDITED
Definition: open62541.h:855
UA_AttributeId
Standard-Defined Constants This section contains numerical and string constants that are defined in t...
Definition: open62541.h:577
#define TAILQ_FIRST(head)
Definition: open62541.c:450
UA_UInt32 data1
Definition: open62541.h:1108
#define UA_TYPES_CALLREQUEST
Definition: open62541.h:3596
ViewAttributes ^^^^^^^^^^^^^^ The attributes for a view node.
Definition: open62541.h:3263
#define UA_ASSERT_RCU_LOCKED()
Definition: open62541.c:4188
#define UA_NS0ID_UINT16
Definition: open62541.h:1800
#define UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER
Definition: open62541.c:2668
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTNAME
Definition: open62541.h:2545
UA_Boolean historizing
Definition: open62541.c:3466
UA_StatusCode status
Definition: open62541.c:781
enum UA_NodeIdType identifierType
Definition: open62541.h:1173
#define UA_STATUSCODE_BADTOOMANYSUBSCRIPTIONS
Definition: open62541.h:789
#define UA_STATUSCODE_BADSEMPAHOREFILEMISSING
Definition: open62541.h:742
UA_NodeId nodeId
Definition: open62541.h:3874
#define UA_STATUSCODE_BADDISCOVERYURLMISSING
Definition: open62541.h:741
UA_BrowseDescription * nodesToBrowse
Definition: open62541.h:5005
#define UA_NS0ID_MODELLINGRULE_MANDATORY
Definition: open62541.h:1858
DeleteNodesItem ^^^^^^^^^^^^^^^ A request to delete a node to the server address space.
Definition: open62541.h:3851
size_t referencesSize
Definition: open62541.h:5028
#define UA_NodeStore_newDataTypeNode()
Definition: open62541.c:3997
UA_CallMethodRequest * methodsToCall
Definition: open62541.h:3593
struct UA_NodeStoreEntry UA_NodeStoreEntry
UA_MessageSecurityMode securityMode
Definition: open62541.h:4292
UA_Boolean isInverse
Definition: open62541.h:3701
#define UA_LOG_ERROR_CHANNEL(LOGGER, CHANNEL, MSG,...)
Definition: open62541.c:3296
UA_MonitoredItemModifyRequest * itemsToModify
Definition: open62541.h:4533
int16_t UA_Int16
Int16 ^^^^^ An integer value between -32 768 and 32 767.
Definition: open62541.h:946
UA_StatusCode UA_EndpointUrl_split(const char *endpointUrl, char *hostname, UA_UInt16 *port, const char **path)
EndpointURL Helper ^^^^^^^^^^^^^^^^^^.
Definition: open62541.c:15087
UA_Boolean includeSubtypes
Definition: open62541.h:4441
#define MAXTIMEOUT
There are four types of job execution:
Definition: open62541.c:17963
UA_UInt16 chunksSoFar
Definition: open62541.c:3226
#define UA_TRANSPORT_CHUNKTYPE
Definition: open62541.c:2647
UA_StatusCode UA_Server_deleteNode(UA_Server *server, const UA_NodeId nodeId, UA_Boolean deleteReferences)
Definition: open62541.c:22412
#define UA_NS0ID_SERVER_SERVERSTATUS_STARTTIME
Definition: open62541.h:2541
#define UA_STATUSCODE_BADCERTIFICATEISSUERTIMEINVALID
Definition: open62541.h:675
void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel)
Definition: open62541.c:19885
UA_NODE_BASEATTRIBUTES UA_NODE_VARIABLEATTRIBUTES UA_Boolean isAbstract
Definition: open62541.c:3484
QueryDataDescription ^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:5056
#define UA_OPEN62541_VER_MINOR
Definition: open62541.h:40
void * methodHandle
Definition: open62541.c:3511
UA_StatusCode UA_SecureChannelManager_init(UA_SecureChannelManager *cm, UA_Server *server)
Definition: open62541.c:18635
size_t elementsSize
Definition: open62541.h:4658
UA_UInt32 receiveBufferSize
Definition: open62541.c:2550
UA_NodeId authenticationToken
Definition: open62541.h:3301
UA_NODE_BASEATTRIBUTES UA_Boolean isAbstract
Definition: open62541.c:3673
UA_ResponseHeader responseHeader
Definition: open62541.h:4401
#define UA_TYPES_BYTE
Byte ^^^^.
Definition: open62541.h:3103
UA_LocalizedText displayName
Definition: open62541.h:4576
BrowseNextResponse ^^^^^^^^^^^^^^^^^^ Continues one or more browse operations.
Definition: open62541.h:5111
#define UA_NS0ID_BASEOBJECTTYPE
Definition: open62541.h:1848
DeleteReferencesItem ^^^^^^^^^^^^^^^^^^^^ A request to delete a node from the server address space...
Definition: open62541.h:3618
int32_t UA_Int32
Int32 ^^^^^ An integer value between -2 147 483 648 and 2 147 483 647.
Definition: open62541.h:962
void UA_Session_updateLifetime(UA_Session *session)
Definition: open62541.c:15677
#define UA_STATUSCODE_UNCERTAINDOMINANTVALUECHANGED
Definition: open62541.h:857
MonitoredItemCreateResult ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3645
UA_StatusCode serviceResult
Definition: open62541.h:3904
#define UA_STATUSCODE_BADSECURECHANNELCLOSED
Definition: open62541.h:805
UA_ConnectionConfig localConf
Definition: open62541.h:9480
UA_DateTime UA_DateTime_nowMonotonic(void)
Definition: open62541.c:27484
UA_String encryptionAlgorithm
Definition: open62541.h:4027
UA_UInt16 namespaceIndex
Definition: open62541.h:1172
UA_ExpandedNodeId targetId
Definition: open62541.h:3702
const UA_String UA_STRING_NULL
Definition: open62541.c:4781
#define UA_STATUSCODE_GOODRESULTSMAYBEINCOMPLETE
Definition: open62541.h:774
UA_ByteString * continuationPoints
Definition: open62541.h:4218
UA_UInt32 UA_UInt32_random(void)
Definition: open62541.c:4811
#define UA_TYPES_MONITORINGPARAMETERS
Definition: open62541.h:3682
UA_ExpandedNodeId nodeId
Definition: open62541.h:4574
ExpandedNodeId ^^^^^^^^^^^^^^ A NodeId that allows the namespace URI to be specified instead of an in...
Definition: open62541.h:1238
UA_UInt32 writeMask
Definition: open62541.h:4426
ParsingResult ^^^^^^^^^^^^^.
Definition: open62541.h:3459
UA_UInt16 addNamespace(UA_Server *server, const UA_String name)
Definition: open62541.c:15760
#define UA_PRINTF_GUID_FORMAT
Convenience macros for complex types ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:9726
CallMethodRequest ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3500
void Service_DeleteSubscriptions(UA_Server *server, UA_Session *session, const UA_DeleteSubscriptionsRequest *request, UA_DeleteSubscriptionsResponse *response)
UA_Boolean isAbstract
Definition: open62541.h:3892
UA_UInt32 maxNotificationsPerPublish
Definition: open62541.h:4232
UA_UInt32 sendBufferSize
Definition: open62541.h:9451
Definition: open62541.c:3209
#define UA_STATUSCODE_BADPROTOCOLVERSIONUNSUPPORTED
Definition: open62541.h:808
#define UA_STATUSCODE_BADSEQUENCENUMBERUNKNOWN
Definition: open62541.h:792
#define UA_realloc(ptr, size)
Definition: open62541.h:105
ObjectNode
Definition: open62541.c:3523
#define WIN32_INT
Definition: open62541.c:26720
UA_RequestHeader requestHeader
Definition: open62541.h:4480
#define UA_NS0ID_STATUSCODE
Definition: open62541.h:1814
UA_ExpandedNodeId targetNodeId
Definition: open62541.h:4619
UA_ByteString serverCertificate
Definition: open62541.h:5157
ActivateSessionResponse ^^^^^^^^^^^^^^^^^^^^^^^ Activates a session with the server.
Definition: open62541.h:4144
VariableAttributes ^^^^^^^^^^^^^^^^^^ The attributes for a variable node.
Definition: open62541.h:3350
#define UA_STATUSCODE_BADSERVERINDEXINVALID
Definition: open62541.h:768
UA_IdType
IdType ^^^^^^ The type of identifier used in a node id.
Definition: open62541.h:4036
UA_StatusCode UA_Subscription_removeRetransmissionMessage(UA_Subscription *sub, UA_UInt32 sequenceNumber)
void UA_random_seed(UA_UInt64 seed)
Random Number Generator If UA_ENABLE_MULTITHREADING is defined, then the seed is stored in thread loc...
Definition: open62541.c:4806
UA_ResponseHeader responseHeader
Definition: open62541.h:4588
#define UA_STATUSCODE_BADREQUESTTYPEINVALID
Definition: open62541.h:743
#define UA_TYPES_SERVICEFAULT
Definition: open62541.h:4927
UA_DateTime currentTime
Definition: open62541.h:4831
#define UA_TYPES_APPLICATIONTYPE
Definition: open62541.h:4106
UA_StatusCode UA_NodeStore_replace(UA_NodeStore *ns, UA_Node *node)
Definition: open62541.c:19421
UA_Boolean deleteSubscriptions
Definition: open62541.h:4317
const char * LogLevelNames[6]
Definition: open62541.c:27523
UA_ChunkType
ChunkType ^^^^^^^^^ Type of the chunk.
Definition: open62541.c:2639
UA_UInt16 serverPicoseconds
Definition: open62541.h:1579
UA_ApplicationDescription clientDescription
Definition: open62541.c:3726
WriteResponse ^^^^^^^^^^^^^.
Definition: open62541.h:4200
SubscriptionAcknowledgement ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3862
void UA_Server_delete(UA_Server *server)
Definition: open62541.c:15879
UA_Double minimumSamplingInterval
Definition: open62541.h:3363
UA_StatusCode UA_Variant_setArrayCopy(UA_Variant *v, const void *array, size_t arraySize, const UA_DataType *type)
Definition: open62541.c:5199
#define UA_STATUSCODE_BADSYNTAXERROR
Definition: open62541.h:877
#define UA_TYPES_MONITOREDITEMNOTIFICATION
Definition: open62541.h:3845
#define UA_STATUSCODE_BADREFERENCENOTALLOWED
Definition: open62541.h:753
UA_CallMethodResult * results
Definition: open62541.h:4699
#define UA_NS0ID_SERVER_SERVERSTATUS_CURRENTTIME
Definition: open62541.h:2542
UserIdentityToken ^^^^^^^^^^^^^^^^^ A base type for a user identity token.
Definition: open62541.h:3726
UA_Boolean isForward
Definition: open62541.h:4617
#define DOUBLE_NEG_INF
Definition: open62541.c:6210
UA_StatusCode(* send)(UA_Connection *connection, UA_ByteString *buf)
Definition: open62541.h:9504
UA_StatusCode UA_Client_addReference(UA_Client *client, const UA_NodeId sourceNodeId, const UA_NodeId referenceTypeId, UA_Boolean isForward, const UA_String targetServerUri, const UA_ExpandedNodeId targetNodeId, UA_NodeClass targetNodeClass)
Definition: open62541.c:25591
#define UA_NS0ID_ACTIVATESESSIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2065
#define UA_TYPES_DATACHANGETRIGGER
Definition: open62541.h:3786
#define UA_STATUSCODE_BADSEQUENCENUMBERINVALID
Definition: open62541.h:807
QueryNextResponse ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4131
UA_NodeAttributesMask
NodeAttributesMask ^^^^^^^^^^^^^^^^^^ The bits used to specify default attributes for a new node...
Definition: open62541.h:3386
#define UA_TYPES_VARIABLEATTRIBUTES
Definition: open62541.h:3367
#define UA_NS0ID_DELETEMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2379
UA_Boolean releaseContinuationPoints
Definition: open62541.h:4216
#define UA_TYPES_CALLMETHODREQUEST
Definition: open62541.h:3507
#define UA_NODEIDTYPE_NUMERIC_FOURBYTE
Definition: open62541.c:6456
#define UA_STATUSCODE_BADOUTOFMEMORY
Definition: open62541.h:654
UA_LocalizedText inverseName
Definition: open62541.c:3654
#define UA_STATUSCODE_BADCONDITIONBRANCHALREADYACKED
Definition: open62541.h:831
#define UA_NodeStore_newObjectNode()
Definition: open62541.c:3987
#define UA_TYPES_CHANNELSECURITYTOKEN
Definition: open62541.h:3834
UA_MethodCallback attachedMethod
Definition: open62541.c:3512
#define UA_TYPES_BOOLEAN
Boolean ^^^^^^^.
Definition: open62541.h:3091
#define UA_STATUSCODE_BADSESSIONNOTACTIVATED
Definition: open62541.h:694
#define UA_STATUSCODE_GOODCOMPLETESASYNCHRONOUSLY
Definition: open62541.h:701
#define SIMPLEQ_REMOVE_HEAD(head, field)
Definition: open62541.c:338
#define UA_NS0ID_SERVER_SERVERARRAY
Definition: open62541.h:2538
UA_ResponseHeader responseHeader
Definition: open62541.h:4711
#define UA_STATUSCODE_BADMAXCONNECTIONSREACHED
Definition: open62541.h:878
UA_MonitoredItem * UA_Subscription_getMonitoredItem(UA_Subscription *sub, UA_UInt32 monitoredItemID)
#define UA_TYPES_BROWSEDESCRIPTION
Definition: open62541.h:4446
#define UA_TYPES_CONTENTFILTERELEMENTRESULT
Definition: open62541.h:3533
#define UA_STATUSCODE_BADBOUNDNOTSUPPORTED
Definition: open62541.h:838
#define UA_TYPES_REFERENCENODE
Definition: open62541.h:3705
UA_UInt32 userWriteMask
Definition: open62541.h:4427
#define UA_NODEIDTYPE_NUMERIC_COMPLETE
Definition: open62541.c:6457
#define UA_STATUSCODE_BADCERTIFICATEISSUERREVOCATIONUNKNOWN
Definition: open62541.h:682
void UA_Subscription_deleteMembers(UA_Subscription *subscription, UA_Server *server)
#define UA_STATUSCODE_BADSERVICEUNSUPPORTED
Definition: open62541.h:664
UA_UInt32 maxNotificationsPerPublish
Definition: open62541.h:4332
Guid ^^^^ A 16 byte value that can be used as a globally unique identifier.
Definition: open62541.h:1107
UA_MessageSecurityMode
MessageSecurityMode ^^^^^^^^^^^^^^^^^^^ The type of security to use on a message. ...
Definition: open62541.h:3659
UA_UInt16 microSec
Definition: open62541.h:1089
UA_StatusCode UA_Node_copyAnyNodeClass(const UA_Node *src, UA_Node *dst)
Definition: open62541.c:19085
UA_Boolean hasSymbolicId
Definition: open62541.h:1588
String ^^^^^^ A sequence of Unicode characters.
Definition: open62541.h:1038
#define UA_STATUSCODE_BADRESOURCEUNAVAILABLE
Definition: open62541.h:655
const UA_Node * UA_NodeStore_get(UA_NodeStore *ns, const UA_NodeId *nodeid)
Definition: open62541.c:19437
MonitoringParameters ^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3674
#define SIMPLEQ_HEAD(name, type)
Definition: open62541.c:280
UA_DeadbandType
DeadbandType ^^^^^^^^^^^^.
Definition: open62541.h:3751
UA_Int32 valueRank
Definition: open62541.h:3714
UA_ResponseHeader responseHeader
Definition: open62541.h:5138
#define UA_TYPES_MONITOREDITEMMODIFYRESULT
Definition: open62541.h:3323
#define UA_assert(ignore)
Definition: open62541.c:744
#define UA_NS0ID_DELETESUBSCRIPTIONSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2439
#define SIMPLEQ_INIT(head)
Definition: open62541.c:315
#define UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER
Definition: open62541.c:2542
void UA_Connection_attachSecureChannel(UA_Connection *connection, UA_SecureChannel *channel)
Definition: open62541.c:15015
type_equivalence
Definition: open62541.c:20067
UA_StatusCode UA_Server_setObjectTypeNode_lifecycleManagement(UA_Server *server, UA_NodeId nodeId, UA_ObjectLifecycleManagement olm)
Definition: open62541.c:22577
UA_NodeId authenticationToken
Definition: open62541.c:3729
#define UA_TYPES_VIEWATTRIBUTES
Definition: open62541.h:3273
#define UA_STATUSCODE_BADTOOMANYPUBLISHREQUESTS
Definition: open62541.h:790
UA_RequestHeader requestHeader
Definition: open62541.h:5039
size_t(* stop)(UA_ServerNetworkLayer *nl, UA_Job **jobs)
Definition: open62541.h:9796
UA_UInt32 receiveSequenceNumber
Definition: open62541.c:3240
#define UA_STATUSCODE_BADNODELETERIGHTS
Definition: open62541.h:766
#define UA_STATUSCODE_BADPARENTNODEIDINVALID
Definition: open62541.h:752
UA_String discoveryUrl
Definition: open62541.h:9767
DeleteMonitoredItemsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4356
#define UA_STATUSCODE_BADEVENTNOTACKNOWLEDGEABLE
Definition: open62541.h:828
UA_StatusCode UA_Connection_completeMessages(UA_Connection *connection, UA_ByteString *message, UA_Boolean *realloced)
Definition: open62541.c:14873
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_AGGREGATEFUNCTIONS
Definition: open62541.h:2637
#define UA_STATUSCODE_BADNONCEINVALID
Definition: open62541.h:691
UA_Boolean UA_NodeId_isNull(const UA_NodeId *p)
Definition: open62541.c:4991
UA_StatusCode statusCode
Definition: open62541.h:3340
void UA_Node_deleteMembersAnyNodeClass(UA_Node *node)
Definition: open62541.c:18954
#define UA_TYPES_LOCALIZEDTEXT
LocalizedText ^^^^^^^^^^^^^.
Definition: open62541.h:3211
AddReferencesResponse ^^^^^^^^^^^^^^^^^^^^^ Adds one or more references to the server address space...
Definition: open62541.h:4844
const UA_EXPORT UA_ServerConfig UA_ServerConfig_standard
Definition: open62541.c:27593
UA_Byte membersSize
Definition: open62541.h:1657
UA_Boolean hasStatus
Definition: open62541.h:1569
UA_StatusCode(* UA_NodeIteratorCallback)(UA_NodeId childId, UA_Boolean isInverse, UA_NodeId referenceTypeId, void *handle)
Definition: open62541.h:10250
UA_Boolean userExecutable
Definition: open62541.h:3609
UA_Double requestedPublishingInterval
Definition: open62541.h:4329
#define UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST
Definition: open62541.h:5131
UA_ConnectionConfig remoteConf
Definition: open62541.h:9481
UA_BrowseResult UA_Server_browseNext(UA_Server *server, UA_Boolean releaseContinuationPoint, const UA_ByteString *continuationPoint)
Definition: open62541.c:22949
const UA_Node * getNodeType(UA_Server *server, const UA_Node *node)
Definition: open62541.c:17828
#define UA_TYPES_RESPONSEHEADER
Definition: open62541.h:3911
UA_StatusCode UA_Server_run_shutdown(UA_Server *server)
Definition: open62541.c:18579
#define UA_STATUSCODE_BADIDENTITYTOKENREJECTED
Definition: open62541.h:688
#define UA_NODE_VARIABLEATTRIBUTES
Definition: open62541.c:3443
#define UA_STATUSCODE_BADSESSIONCLOSED
Definition: open62541.h:693
UA_ResponseHeader responseHeader
Definition: open62541.h:4669
#define DOUBLE_NAN
Definition: open62541.c:6208
#define UA_STATUSCODE_GOOD
Definition: open62541.h:651
UA_String locale
Definition: open62541.h:1314
#define UA_STATUSCODE_BADNOTTYPEDEFINITION
Definition: open62541.h:775
#define UA_STATUSCODE_BADNOTHINGTODO
Definition: open62541.h:668
Definition: open62541.c:19164
#define UA_NS0ID_REGISTERNODESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2158
UA_Guid guid
Definition: open62541.h:1177
#define UA_STATUSCODE_GOODCLAMPED
Definition: open62541.h:703
UA_NodeId nodeId
Definition: open62541.h:1239
UA_EXPORT const UA_DataType UA_TRANSPORT[UA_TRANSPORT_COUNT]
Definition: open62541.c:14689
struct UA_SecureChannelManager UA_SecureChannelManager
UA_ExpandedNodeId requestedNewNodeId
Definition: open62541.h:4816
#define UA_STATUSCODE_BADNOTREADABLE
Definition: open62541.h:713
UA_StatusCode UA_Variant_setScalarCopy(UA_Variant *v, const void *p, const UA_DataType *type)
Definition: open62541.c:5174
#define UA_RCU_LOCK()
Definition: open62541.c:4186
void UA_SecureChannel_detachSession(UA_SecureChannel *channel, UA_Session *session)
Definition: open62541.c:15234
#define UA_TYPES_UNREGISTERNODESRESPONSE
Definition: open62541.h:4404
void Service_ModifySubscription(UA_Server *server, UA_Session *session, const UA_ModifySubscriptionRequest *request, UA_ModifySubscriptionResponse *response)
#define WOULDBLOCK
Definition: open62541.c:26767
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXHISTORYCONTINUATIONPOINTS
Definition: open62541.h:2613
UA_StatusCode typeCheckValue(UA_Server *server, const UA_NodeId *targetDataTypeId, UA_Int32 targetValueRank, size_t targetArrayDimensionsSize, const UA_UInt32 *targetArrayDimensions, const UA_Variant *value, const UA_NumericRange *range, UA_Variant *editableValue)
Definition: open62541.c:20195
#define UA_NS0ID_ROOTFOLDER
Definition: open62541.h:1862
UA_ResponseHeader responseHeader
Definition: open62541.h:3942
UA_StatusCode UA_Client_getEndpoints(UA_Client *client, const char *serverUrl, size_t *endpointDescriptionsSize, UA_EndpointDescription **endpointDescriptions)
Definition: open62541.c:25229
int8_t UA_SByte
SByte ^^^^^ An integer value between -128 and 127.
Definition: open62541.h:930
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_LOCALEIDARRAY
Definition: open62541.h:2554
UA_Boolean UA_NodeId_equal(const UA_NodeId *n1, const UA_NodeId *n2)
Definition: open62541.c:5016
#define UA_TYPES_FILTEROPERATOR
Definition: open62541.h:4182
#define UA_TYPES_CLOSESECURECHANNELREQUEST
Definition: open62541.h:3333
#define UA_NS0ID_SETMONITORINGMODEREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2367
CloseSessionRequest ^^^^^^^^^^^^^^^^^^^ Closes a session with the server.
Definition: open62541.h:4315
#define UA_STATUSCODE_BADCERTIFICATETIMEINVALID
Definition: open62541.h:674
ReadResponse ^^^^^^^^^^^^.
Definition: open62541.h:4773
#define UA_STATUSCODE_GOODSUBSCRIPTIONTRANSFERRED
Definition: open62541.h:700
UA_BrowseDirection
BrowseDirection ^^^^^^^^^^^^^^^ The directions of the references to return.
Definition: open62541.h:3486
#define UA_NS0ID_DATETIME
Definition: open62541.h:1808
WriteRequest ^^^^^^^^^^^^.
Definition: open62541.h:4410
const UA_StatusCodeDescription * UA_StatusCode_description(UA_StatusCode code)
Definition: open62541.c:26673
UA_StatusCode MonitoredItem_unregisterSampleJob(UA_Server *server, UA_MonitoredItem *mon)
#define UA_TYPES_VIEWDESCRIPTION
Definition: open62541.h:3935
UA_ConnectionConfig conf
Definition: open62541.c:26947
void UA_NodeStore_delete(UA_NodeStore *ns)
Definition: open62541.c:19353
#define UA_TYPES_QUERYFIRSTREQUEST
Definition: open62541.h:5182
#define UA_NS0ID_SERVER_SERVERSTATUS
Definition: open62541.h:2540
#define UA_NS0ID_STRUCTURE
Definition: open62541.h:1817
UA_StatusCode parse_numericrange(const UA_String *str, UA_NumericRange *range)
Definition: open62541.c:17673
UA_Boolean isArray
Definition: open62541.h:1647
#define UA_STATUSCODE_BADUSERACCESSDENIED
Definition: open62541.h:686
#define UA_STATUSCODE_UNCERTAINNOTALLNODESAVAILABLE
Definition: open62541.h:773
#define UA_NS0ID_SETPUBLISHINGMODEREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2397
UA_StatusCode writeValueRankAttribute(UA_Server *server, UA_VariableNode *node, UA_Int32 valueRank, UA_Int32 constraintValueRank)
Definition: open62541.c:20334
void Service_AddNodes(UA_Server *server, UA_Session *session, const UA_AddNodesRequest *request, UA_AddNodesResponse *response)
NodeManagement Service Set This Service Set defines Services to add and delete AddressSpace Nodes and...
Definition: open62541.c:22011
UA_StatusCode __UA_Client_addNode(UA_Client *client, const UA_NodeClass nodeClass, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, const UA_QualifiedName browseName, const UA_NodeId typeDefinition, const UA_NodeAttributes *attr, const UA_DataType *attributeType, UA_NodeId *outNewNodeId)
Definition: open62541.c:25681
#define UA_UINT32_MAX
Definition: open62541.h:972
#define UA_STATUSCODE_BADDATAENCODINGUNSUPPORTED
Definition: open62541.h:712
ActivateSessionRequest ^^^^^^^^^^^^^^^^^^^^^^ Activates a session with the server.
Definition: open62541.h:4067
UA_NodeClass nodeClass
Definition: open62541.h:4818
#define FLOAT_NEG_INF
Definition: open62541.c:6175
#define UA_STATUSCODE_BADCONNECTIONCLOSED
Definition: open62541.h:869
UA_SecureChannel * channel
Definition: open62541.c:3223
UA_Byte * data
Definition: open62541.h:1040
UA_StatusCode UA_SecureChannel_sendBinaryMessage(UA_SecureChannel *channel, UA_UInt32 requestId, const void *content, const UA_DataType *contentType)
Definition: open62541.c:15345
#define UA_STATUSCODE_GOODENTRYINSERTED
Definition: open62541.h:844
#define UA_STATUSCODE_BADCOMMUNICATIONERROR
Definition: open62541.h:656
#define UA_TYPES_STATUSCODE
StatusCode ^^^^^^^^^^.
Definition: open62541.h:3199
ResponseHeader ^^^^^^^^^^^^^^ The header passed with every server response.
Definition: open62541.h:3901
void UA_SessionManager_deleteMembers(UA_SessionManager *sm)
Definition: open62541.c:18829
size_t(* UA_calcSizeBinarySignature)(const void *UA_RESTRICT p, const UA_DataType *contenttype)
Definition: open62541.c:5871
void * data
Definition: open62541.h:1403
#define UA_TYPES_BROWSEDIRECTION
Definition: open62541.h:3494
void * instanceHandle
Definition: open62541.c:3528
CloseSecureChannelRequest ^^^^^^^^^^^^^^^^^^^^^^^^^ Closes a secure channel.
Definition: open62541.h:3329
#define UA_STATUSCODE_BADREQUESTHEADERINVALID
Definition: open62541.h:696
#define UA_TYPES_REGISTERNODESREQUEST
Definition: open62541.h:3975
#define UA_TYPES_EXTENSIONOBJECT
ExtensionObject ^^^^^^^^^^^^^^^.
Definition: open62541.h:3217
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MODELLINGRULES
Definition: open62541.h:2636
#define UA_TYPES_UNREGISTERNODESREQUEST
Definition: open62541.h:3519
#define PCG32_INITIALIZER
Definition: open62541.c:716
UA_SessionManager sessionManager
Definition: open62541.c:4217
UA_ResponseHeader responseHeader
Definition: open62541.h:4543
UA_UInt32 requestedMaxKeepAliveCount
Definition: open62541.h:4331
SetMonitoringModeResponse ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4542
#define UA_TYPES_BROWSERESULT
Definition: open62541.h:5032
ServerStatusDataType ^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4829
UA_ByteString serverNonce
Definition: open62541.c:3239
void(* releaseSendBuffer)(UA_Connection *connection, UA_ByteString *buf)
Definition: open62541.h:9496
UA_UInt32 count
Definition: open62541.c:19174
UA_Connection * closeConnection
Definition: open62541.h:9587
#define LIST_FOREACH_SAFE(var, head, field, tvar)
Definition: open62541.c:224
void Service_DeleteReferences(UA_Server *server, UA_Session *session, const UA_DeleteReferencesRequest *request, UA_DeleteReferencesResponse *response)
Definition: open62541.c:22475
UA_UInt32 UA_NodeId_hash(const UA_NodeId *n)
Definition: open62541.c:5052
void Service_GetEndpoints(UA_Server *server, UA_Session *session, const UA_GetEndpointsRequest *request, UA_GetEndpointsResponse *response)
Definition: open62541.c:19765
UA_NodeId referenceTypeId
Definition: open62541.h:4815
UA_StatusCode UA_Variant_setRange(UA_Variant *v, void *UA_RESTRICT array, size_t arraySize, const UA_NumericRange range)
Definition: open62541.c:5495
size_t methodsToCallSize
Definition: open62541.h:3592
UA_NodeId typeId
Definition: open62541.h:1654
#define UA_STATUSCODE_BADSECURITYMODEINSUFFICIENT
Definition: open62541.h:781
BrowsePath ^^^^^^^^^^ A request to translate a path into a node id.
Definition: open62541.h:5014
#define UA_TYPES_QUERYNEXTRESPONSE
Definition: open62541.h:4138
DeleteSubscriptionsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4643
RelativePathElement ^^^^^^^^^^^^^^^^^^^ An element in a relative path.
Definition: open62541.h:3473
#define UA_STATUSCODE_BADSECURITYCHECKSFAILED
Definition: open62541.h:673
UA_LocalizedText displayName
Definition: open62541.h:3957
UA_NotificationMessage notificationMessage
Definition: open62541.h:3999
UA_FilterOperator
FilterOperator ^^^^^^^^^^^^^^.
Definition: open62541.h:4159
#define UA_STATUSCODE_BADCONDITIONNOTSHELVED
Definition: open62541.h:834
#define UA_TYPES_MONITOREDITEMCREATERESULT
Definition: open62541.h:3653
UA_String string
Definition: open62541.h:1176
#define UA_calloc(num, size)
Definition: open62541.h:104
uint8_t UA_Byte
Byte ^^^^ An integer value between 0 and 255.
Definition: open62541.h:938
BrowseResult ^^^^^^^^^^^^ The result of a browse operation.
Definition: open62541.h:5025
UA_DateTimeStruct UA_DateTime_toStruct(UA_DateTime t)
Definition: open62541.c:4854
void UA_Session_init(UA_Session *session)
Definition: open62541.c:15627
#define UA_STATUSCODE_BADMETHODINVALID
Definition: open62541.h:787
SecureConversationMessageHeader ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Secure Layer Sequence Header...
Definition: open62541.c:2663
#define UA_STATUSCODE_BADSENSORFAILURE
Definition: open62541.h:812
#define FLOAT_NAN
Definition: open62541.c:6173
#define UA_STATUSCODE_BADCERTIFICATEREVOCATIONUNKNOWN
Definition: open62541.h:681
void UA_SecureChannel_deleteMembersCleanup(UA_SecureChannel *channel)
Definition: open62541.c:15171
UA_String name
Definition: open62541.h:3712
#define UA_BYTE_MAX
Definition: open62541.h:940
size_t nodesToBrowseSize
Definition: open62541.h:5004
UA_String indexRange
Definition: open62541.h:3876
#define UA_STATUSCODE_BADFILTEROPERANDCOUNTMISMATCH
Definition: open62541.h:730
#define UA_NS0ID_HASNOTIFIER
Definition: open62541.h:1841
#define UA_TYPES_DELETEREFERENCESREQUEST
Definition: open62541.h:4753
UA_QualifiedName dataEncoding
Definition: open62541.h:3877
UA_Boolean namespaceZero
Definition: open62541.h:1642
#define UA_STATUSCODE_BADAGGREGATENOTSUPPORTED
Definition: open62541.h:850
UA_UInt32 maxChunkCount
Definition: open62541.c:2553
#define DAYS_PER_4Y
Definition: open62541.c:26307
VariableTypeAttributes ^^^^^^^^^^^^^^^^^^^^^^ The attributes for a variable type node.
Definition: open62541.h:4243
UA_Boolean hasInnerStatusCode
Definition: open62541.h:1593
#define UA_TYPES_NOTIFICATIONMESSAGE
Definition: open62541.h:3380
UA_String namespaceUri
Definition: open62541.h:1240
#define UA_TYPES_TIMESTAMPSTORETURN
Definition: open62541.h:3584
UA_ReferenceDescription * references
Definition: open62541.h:5029
#define UA_STATUSCODE_BADNOSUBSCRIPTION
Definition: open62541.h:791
UA_StatusCode(* getSendBuffer)(UA_Connection *connection, size_t length, UA_ByteString *buf)
Definition: open62541.h:9492
CloseSecureChannelResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^ Closes a secure channel.
Definition: open62541.h:4518
Definition: open62541.c:3879
#define UA_TYPES_SECURITYTOKENREQUESTTYPE
Definition: open62541.h:3772
UA_AddNodesResult * results
Definition: open62541.h:4494
#define UA_NS0ID_UINT32
Definition: open62541.h:1802
#define DAYS_PER_100Y
Definition: open62541.c:26306
#define PRODUCT_NAME
Definition: open62541.c:27577
#define UA_STATUSCODE_BADUNEXPECTEDERROR
Definition: open62541.h:652
UA_StatusCode status
Definition: open62541.h:1575
#define UA_TYPES_DELETESUBSCRIPTIONSREQUEST
Definition: open62541.h:3923
#define UA_STATUSCODE_BADWRITENOTSUPPORTED
Definition: open62541.h:785
#define UA_NS0ID_GUID
Definition: open62541.h:1809
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_SOFTWARECERTIFICATES
Definition: open62541.h:2657
UA_Boolean hasAdditionalInfo
Definition: open62541.h:1592
UA_ByteString clientNonce
Definition: open62541.h:5044
UA_UInt32 sizePrimeIndex
Definition: open62541.c:19175
ViewNode
Definition: open62541.c:3685
#define UA_EXPANDEDNODEID_NAMESPACEURI_FLAG
Definition: open62541.c:6460
#define UA_NS0ID_BUILDINFOTYPE
Definition: open62541.h:2646
UA_ResponseHeader responseHeader
Definition: open62541.h:4683
#define UA_STATUSCODE_BADWAITINGFORRESPONSE
Definition: open62541.h:873
UA_NODE_BASEATTRIBUTES UA_Byte eventNotifier
Definition: open62541.c:3687
UA_Boolean hasLocale
Definition: open62541.h:1591
#define UA_TYPES_ANONYMOUSIDENTITYTOKEN
Definition: open62541.h:3556
void UA_delete(void *p, const UA_DataType *type)
Definition: open62541.c:5753
UA_ServerState
ServerState ^^^^^^^^^^^.
Definition: open62541.h:4112
UA_UInt32 * availableSequenceNumbers
Definition: open62541.h:3997
#define UA_STATUSCODE_BADUNKNOWNRESPONSE
Definition: open62541.h:662
void UA_Subscription_answerPublishRequestsNoSubscription(UA_Server *server, UA_NodeId *sessionToken)
GetEndpointsRequest ^^^^^^^^^^^^^^^^^^^ Gets the endpoints used by the server.
Definition: open62541.h:4464
void Service_AddReferences(UA_Server *server, UA_Session *session, const UA_AddReferencesRequest *request, UA_AddReferencesResponse *response)
Definition: open62541.c:22306
#define UA_NS0ID_HASHISTORICALCONFIGURATION
Definition: open62541.h:1847
UA_StatusCode(* UA_copySignature)(const void *src, void *dst, const UA_DataType *type)
Definition: open62541.c:5613
void pcg32_srandom_r(pcg32_random_t *rng, uint64_t initial_state, uint64_t initseq)
Definition: open62541.c:26407
UA_ExpandedNodeId targetNodeId
Definition: open62541.h:3622
UA_Boolean hasServerPicoseconds
Definition: open62541.h:1573
#define SLIST_INIT(head)
Definition: open62541.c:158
#define UA_TYPES_RELATIVEPATHELEMENT
Definition: open62541.h:3480
UA_ExtensionObject * notificationData
Definition: open62541.h:3377
AddNodesResult ^^^^^^^^^^^^^^ A result of an add node operation.
Definition: open62541.h:3339
#define UA_TYPES_DOUBLE
Double ^^^^^^.
Definition: open62541.h:3151
#define LIST_INSERT_AFTER(listelm, elm, field)
Definition: open62541.c:236
void(* releaseRecvBuffer)(UA_Connection *connection, UA_ByteString *buf)
Definition: open62541.h:9520
UA_String securityPolicyUri
Definition: open62541.h:5073
UA_ServerNetworkLayer UA_ServerNetworkLayerTCP(UA_ConnectionConfig conf, UA_UInt16 port)
Definition: open62541.c:27272
#define UA_STATUSCODE_BADCONTENTFILTERINVALID
Definition: open62541.h:727
CreateSessionResponse ^^^^^^^^^^^^^^^^^^^^^ Creates a new session with the server.
Definition: open62541.h:5151
UA_String text
Definition: open62541.h:1315
const UA_ByteString UA_BYTESTRING_NULL
Definition: open62541.c:4782
#define UA_STATUSCODE_BADFILTEROPERATORUNSUPPORTED
Definition: open62541.h:729
#define UA_TYPES_BROWSENEXTRESPONSE
Definition: open62541.h:5119
UA_NodeClass
NodeClass ^^^^^^^^^ A mask specifying the class of the node.
Definition: open62541.h:3807
UA_StatusCode UA_SecureChannelManager_renew(UA_SecureChannelManager *cm, UA_Connection *conn, const UA_OpenSecureChannelRequest *request, UA_OpenSecureChannelResponse *response)
Definition: open62541.c:18758
UA_UInt32 remainingPathIndex
Definition: open62541.h:3254
UA_StatusCode UA_Variant_copyRange(const UA_Variant *src, UA_Variant *dst, const UA_NumericRange range)
Definition: open62541.c:5323
#define UA_TYPES_INT64
Int64 ^^^^^.
Definition: open62541.h:3133
#define UA_NS0ID_AGGREGATES
Definition: open62541.h:1837
#define UA_STATUSCODE_BADSOURCENODEIDINVALID
Definition: open62541.h:761
UA_TimestampsToReturn
TimestampsToReturn ^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3575
#define UA_NS0ID_EVENTTYPESFOLDER
Definition: open62541.h:2645
UA_StatusCode UA_Server_addRepeatedJob(UA_Server *server, UA_Job job, UA_UInt32 interval, UA_Guid *jobId)
Repeated jobs
Definition: open62541.c:18111
RegisterNodesRequest ^^^^^^^^^^^^^^^^^^^^ Registers one or more nodes for repeated use within a sessi...
Definition: open62541.h:3969
EndpointDescription ^^^^^^^^^^^^^^^^^^^ The description of a endpoint that can be used to access a se...
Definition: open62541.h:5068
#define LIST_EMPTY(head)
Definition: open62541.c:216
#define UA_BINARY_OVERLAYABLE_FLOAT
Float Endianness ^^^^^^^^^^^^^^^^ The definition UA_BINARY_OVERLAYABLE_FLOAT is true when the floatin...
Definition: open62541.h:268
UA_LocalizedText description
Definition: open62541.h:4425
ObjectAttributes ^^^^^^^^^^^^^^^^ The attributes for an object node.
Definition: open62541.h:4422
#define UA_NS0ID_SERVER_SERVICELEVEL
Definition: open62541.h:2551
#define UA_TYPES_QUERYNEXTREQUEST
Definition: open62541.h:4194
#define UA_STATUSCODE_BADTCPSERVERTOOBUSY
Definition: open62541.h:796
#define UA_TYPES_ACTIVATESESSIONRESPONSE
Definition: open62541.h:4153
#define UA_TYPES_REQUESTHEADER
Definition: open62541.h:3310
UA_DataTypeMember * members
Definition: open62541.h:1666
UA_ResponseHeader responseHeader
Definition: open62541.h:4725
#define UA_TYPES_UINT16
UInt16 ^^^^^^.
Definition: open62541.h:3115
UA_SecureChannel * channel
Definition: open62541.c:3735
UA_StatusCode UA_encodeBinary(const void *src, const UA_DataType *type, UA_exchangeEncodeBuffer exchangeCallback, void *exchangeHandle, UA_ByteString *dst, size_t *offset) UA_FUNC_ATTR_WARN_UNUSED_RESULT
Definition: open62541.c:7246
#define UA_TYPES_VARIANT
Variant ^^^^^^^.
Definition: open62541.h:3229
void UA_SecureChannelManager_cleanupTimedOut(UA_SecureChannelManager *cm, UA_DateTime nowMonotonic)
Definition: open62541.c:18680
UA_TimestampsToReturn timestampsToReturn
Definition: open62541.h:4948
DeleteReferencesResponse ^^^^^^^^^^^^^^^^^^^^^^^^ Delete one or more references from the server addre...
Definition: open62541.h:4668
#define UA_TYPES_NODECLASS
Definition: open62541.h:3821
#define LIST_INIT(head)
Definition: open62541.c:232
#define UA_STATUSCODE_GOODOVERLOAD
Definition: open62541.h:702
void(* close)(UA_Connection *connection)
Definition: open62541.h:9523
UA_UInt32 requestHandle
Definition: open62541.h:3903
#define UA_FALSE
Definition: open62541.h:924
UA_NODE_BASEATTRIBUTES UA_Boolean executable
Definition: open62541.c:3507
void UA_Variant_setArray(UA_Variant *v, void *UA_RESTRICT array, size_t arraySize, const UA_DataType *type)
Definition: open62541.c:5190
#define UA_STATUSCODE_BADVIEWTIMESTAMPINVALID
Definition: open62541.h:770
void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel, const UA_CreateSessionRequest *request, UA_CreateSessionResponse *response)
Session Service Set This Service Set defines Services for an application layer connection establishme...
Definition: open62541.c:19897
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_SERVERPROFILEARRAY
Definition: open62541.h:2553
size_t availableSequenceNumbersSize
Definition: open62541.h:3996
#define UA_STATUSCODE_BADIDENTITYTOKENINVALID
Definition: open62541.h:687
#define PRODUCT_URI
Definition: open62541.c:27578
#define UA_fd_set(fd, fds)
Definition: open62541.c:26748
#define UA_alloca(SIZE)
Definition: open62541.h:113
UA_String name
Definition: open62541.h:1289
#define UA_NS0ID_SERVER_SERVERCAPABILITIES
Definition: open62541.h:2552
struct UA_NotificationMessageEntry UA_NotificationMessageEntry
#define AGAIN
Definition: open62541.c:26768
#define UA_STATUSCODE_BADBROWSEDIRECTIONINVALID
Definition: open62541.h:737
#define UA_STRING_STATIC(s)
Definition: open62541.c:27582
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: open62541.c:466
#define UA_STATUSCODE_GOODLOCALOVERRIDE
Definition: open62541.h:822
UA_Byte u8
Definition: open62541.c:773
#define SLIST_HEAD(name, type)
Definition: open62541.c:119
#define UA_TYPES_SERVERSTATE
Definition: open62541.h:4125
#define LIST_INSERT_HEAD(head, elm, field)
Definition: open62541.c:251
#define UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY
Definition: open62541.c:2530
MonitoredItemCreateRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4735
void(* UA_Logger)(UA_LogLevel level, UA_LogCategory category, const char *msg, va_list args)
The signature of the logger.
Definition: open62541.h:9654
ModifyMonitoredItemsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4759
UA_SecurityTokenRequestType
SecurityTokenRequestType ^^^^^^^^^^^^^^^^^^^^^^^^ Indicates whether a token if being created or renew...
Definition: open62541.h:3765
#define UA_NS0ID_HASEVENTSOURCE
Definition: open62541.h:1831
#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS
Definition: open62541.h:2556
#define UA_STATUSCODE_BADSECURITYPOLICYREJECTED
Definition: open62541.h:745
UA_STATIC_ASSERT(sizeof(UA_MessageType)==sizeof(UA_Int32), enum_must_be_32bit)
#define UA_NS0ID_CLOSESESSIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2071
#define UA_STATUSCODE_BADINVALIDSTATE
Definition: open62541.h:870
size_t messageSizeSoFar
Definition: open62541.c:3227
#define UA_STATUSCODE_BADCONDITIONALREADYENABLED
Definition: open62541.h:825
#define UA_NS0ID_DIAGNOSTICINFO
Definition: open62541.h:1820
#define UA_NS0ID_SERVER_GETMONITOREDITEMS
Definition: open62541.h:2769
#define UA_STATUSCODE_BADFILTERLITERALINVALID
Definition: open62541.h:733
#define UA_STATUSCODE_BADARGUMENTSMISSING
Definition: open62541.h:788
#define UA_STATUSCODE_UNCERTAINSUBSTITUTEVALUE
Definition: open62541.h:817
UA_Double maxAge
Definition: open62541.h:4801
#define UA_STATUSCODE_BADNODATAAVAILABLE
Definition: open62541.h:872
#define UA_STATUSCODE_UNCERTAINDEPENDENTVALUECHANGED
Definition: open62541.h:860
UA_StatusCode Service_AddNodes_existing(UA_Server *server, UA_Session *session, UA_Node *node, const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId, const UA_NodeId *typeDefinition, UA_InstantiationCallback *instantiationCallback, UA_NodeId *addedNodeId)
Definition: open62541.c:21664
UA_NodeId referenceTypeId
Definition: open62541.h:4440
UA_UInt32 * arrayDimensions
Definition: open62541.h:3360
#define UA_TYPES_OBJECTTYPEATTRIBUTES
Definition: open62541.h:3745
UA_StatusCode UA_Array_copy(const void *src, size_t size, void **dst, const UA_DataType *type)
Definition: open62541.c:5770
#define UA_STATUSCODE_BADATTRIBUTEIDINVALID
Definition: open62541.h:708
UA_Double samplingInterval
Definition: open62541.h:3676
UA_MonitoringMode monitoringMode
Definition: open62541.h:4389
#define UA_THREAD_LOCAL
Definition: open62541.c:766
#define UA_TYPES_CREATESESSIONREQUEST
Definition: open62541.h:5050
ContentFilterElementResult ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3525
#define UA_TYPES_BROWSEPATHTARGET
Definition: open62541.h:3257
UA_UInt32 attributeId
Definition: open62541.h:3634
#define UA_TYPES_NODETYPEDESCRIPTION
Definition: open62541.h:5105
#define UA_DATETIME_UNIX_EPOCH
Definition: open62541.h:1078
UA_UInt32 messageTypeAndChunkType
Definition: open62541.c:2629
#define UA_STATUSCODE_BADINVALIDTIMESTAMP
Definition: open62541.h:690
#define LIST_FOREACH(var, head, field)
Definition: open62541.c:219
void Service_Write(UA_Server *server, UA_Session *session, const UA_WriteRequest *request, UA_WriteResponse *response)
Definition: open62541.c:21146
#define UA_TYPES_OBJECTATTRIBUTES
Definition: open62541.h:4431
BrowseDescription ^^^^^^^^^^^^^^^^^ A request to browse the the references from a node...
Definition: open62541.h:4437
#define UA_NS0ID_BASEVARIABLETYPE
Definition: open62541.h:1850
#define UA_NodeStore_newMethodNode()
Definition: open62541.c:3989
#define UA_STATUSCODE_BADCERTIFICATEURIINVALID
Definition: open62541.h:677
#define UA_NS0ID_MODELLINGRULETYPE
Definition: open62541.h:1857
#define UA_STATUSCODE_BADTCPSECURECHANNELUNKNOWN
Definition: open62541.h:798
#define UA_NS0ID_SERVERSTATUSTYPE
Definition: open62541.h:2527
UA_StatusCode UA_Client_deleteNode(UA_Client *client, const UA_NodeId nodeId, UA_Boolean deleteTargetReferences)
Definition: open62541.c:25655
#define UA_NS0ID_READREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2229
#define UA_NS0ID_EXPANDEDNODEID
Definition: open62541.h:1813
struct session_list_entry session_list_entry
#define UA_RESTRICT
Non-aliasing pointers
Definition: open62541.h:163
#define UA_STATUSCODE_BADFILTEROPERATORINVALID
Definition: open62541.h:728
#define UA_TYPES_QUERYDATADESCRIPTION
Definition: open62541.h:5062
void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session, const UA_ModifyMonitoredItemsRequest *request, UA_ModifyMonitoredItemsResponse *response)
int __secs_to_tm(long long t, struct tm *tm)
Definition: open62541.c:26309
#define UA_NS0ID_BYTE
Definition: open62541.h:1798
UA_StatusCode UA_Client_deleteReference(UA_Client *client, const UA_NodeId sourceNodeId, const UA_NodeId referenceTypeId, UA_Boolean isForward, const UA_ExpandedNodeId targetNodeId, UA_Boolean deleteBidirectional)
Definition: open62541.c:25624
#define UA_STATUSCODE_BADCONFIGURATIONERROR
Definition: open62541.h:809
#define UA_STATUSCODE_BADTOOMANYMONITOREDITEMS
Definition: open62541.h:670
status(* UA_encodeBinarySignature)(const void *UA_RESTRICT src, const UA_DataType *type)
Definition: open62541.c:5865
void Service_RegisterNodes(UA_Server *server, UA_Session *session, const UA_RegisterNodesRequest *request, UA_RegisterNodesResponse *response)
Definition: open62541.c:23284
UA_UInt16 binaryEncodingId
Definition: open62541.h:1664
size_t arrayDimensionsSize
Definition: open62541.h:1404
UA_Boolean userExecutable
Definition: open62541.c:3508
UA_SubscriptionAcknowledgement * subscriptionAcknowledgements
Definition: open62541.h:4482
void Service_Republish(UA_Server *server, UA_Session *session, const UA_RepublishRequest *request, UA_RepublishResponse *response)
UA_String targetServerUri
Definition: open62541.h:4618
UA_Int32 localizedText
Definition: open62541.h:1597
UA_BrowseResult * results
Definition: open62541.h:5140
#define UA_NS0ID_MODELLINGRULE_OPTIONAL
Definition: open62541.h:1860
UA_TimestampsToReturn timestampsToReturn
Definition: open62541.h:4802
#define UA_NS0ID_HASCHILD
Definition: open62541.h:1829
union UA_NodeId::@0 identifier
#define UA_NS0ID_OBJECTTYPESFOLDER
Definition: open62541.h:1866
#define UA_TYPES_DATETIME
DateTime ^^^^^^^^.
Definition: open62541.h:3163
UA_ReadValueId itemToMonitor
Definition: open62541.h:4736
UA_ResponseHeader responseHeader
Definition: open62541.h:4774
UA_Client * UA_Client_new(UA_ClientConfig config)
Definition: open62541.c:24689
#define UA_STATUSCODE_BADDATATYPEIDUNKNOWN
Definition: open62541.h:671
UA_UsernamePasswordLogin usernamePasswords[2]
Definition: open62541.c:27589
#define UA_NS0ID_REPUBLISHREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2424
#define UA_TYPES_SETPUBLISHINGMODERESPONSE
Definition: open62541.h:4595
#define UA_TYPES_MONITORINGMODE
Definition: open62541.h:3437
#define UA_TYPES_REFERENCEDESCRIPTION
Definition: open62541.h:4581
#define UA_TYPES_ADDREFERENCESREQUEST
Definition: open62541.h:4793
UA_DataChangeTrigger
DataChangeTrigger ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3778
UA_MonitoredItemType
Definition: open62541.c:3828
#define UA_TYPES_VARIABLETYPEATTRIBUTES
Definition: open62541.h:4257
QueryFirstResponse ^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4970
#define UA_TYPES_APPLICATIONDESCRIPTION
Definition: open62541.h:4917
UA_ReadValueId * nodesToRead
Definition: open62541.h:4804
UA_MonitoringMode monitoringMode
Definition: open62541.h:4737
struct UA_SessionManager UA_SessionManager
UA_ExpandedNodeId targetId
Definition: open62541.h:3253
RepublishRequest ^^^^^^^^^^^^^^^^.
Definition: open62541.h:4452
#define UA_STATUSCODE_BADTCPNOTENOUGHRESOURCES
Definition: open62541.h:800
UA_StatusCode statusCode
Definition: open62541.h:4264
#define UA_TYPES_USERTOKENPOLICY
Definition: open62541.h:4350
UA_NotificationMessage notificationMessage
Definition: open62541.h:4726
#define UA_NS0ID_NUMBER
Definition: open62541.h:1821
#define UA_STATUSCODE_UNCERTAINENGINEERINGUNITSEXCEEDED
Definition: open62541.h:820
enum UA_Job::@4 type
#define UA_STATUSCODE_BADFILTERNOTALLOWED
Definition: open62541.h:724
UA_RequestHeader requestHeader
Definition: open62541.h:4068
DataChangeNotification ^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4505
const char * LogCategoryNames[6]
Definition: open62541.c:27524
UA_UInt32 sendSequenceNumber
Definition: open62541.c:3241
const UA_DataType UA_TYPES[UA_TYPES_COUNT]
Definition: open62541.c:12130
UA_BuildInfo buildInfo
Definition: open62541.h:4833
UA_UInt32 sequenceNumber
Definition: open62541.c:2618
#define UA_TYPES_XMLELEMENT
XmlElement ^^^^^^^^^^.
Definition: open62541.h:3181
UA_NodeId * nodesToRegister
Definition: open62541.h:3972
#define UA_TRUE
Definition: open62541.h:923
#define UA_STRING_ALLOC(CHARS)
Definition: open62541.h:1060
#define UA_TYPES_DIAGNOSTICINFO
DiagnosticInfo ^^^^^^^^^^^^^^.
Definition: open62541.h:3235
#define UA_TYPES_CREATEMONITOREDITEMSREQUEST
Definition: open62541.h:4953
#define UA_TYPES_DELETEMONITOREDITEMSRESPONSE
Definition: open62541.h:3949
#define UA_STATUSCODE_BADWAITINGFORINITIALDATA
Definition: open62541.h:705
void Service_Browse_single(UA_Server *server, UA_Session *session, struct ContinuationPointEntry *cp, const UA_BrowseDescription *descr, UA_UInt32 maxrefs, UA_BrowseResult *result)
Definition: open62541.c:22713
UA_UInt32 numeric
Definition: open62541.h:1175
#define UA_EMPTY_ARRAY_SENTINEL
Definition: open62541.h:1389
PublishResponse ^^^^^^^^^^^^^^^.
Definition: open62541.h:3993
UA_RelativePath relativePath
Definition: open62541.h:5016
UA_StatusCode __UA_Client_readAttribute(UA_Client *client, const UA_NodeId *nodeId, UA_AttributeId attributeId, void *out, const UA_DataType *outDataType)
Definition: open62541.c:25848
#define UA_TYPES_CREATEMONITOREDITEMSRESPONSE
Definition: open62541.h:4690
UA_NodeId * registeredNodeIds
Definition: open62541.h:4306
UA_UserTokenType
UserTokenType ^^^^^^^^^^^^^ The possible user token types.
Definition: open62541.h:4051
UA_ConnectionState state
Definition: open62541.h:9479
UA_StatusCode UA_copy(const void *src, void *dst, const UA_DataType *type)
Definition: open62541.c:5681
UA_UInt32 serverIndex
Definition: open62541.h:1241
UA_LocalizedText displayName
Definition: open62541.h:3604
UA_String endpointUrl
Definition: open62541.c:4738
UA_StatusCode UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data)
Definition: open62541.c:18295
#define UA_malloc(_p_size)
UA_Variant * outputArguments
Definition: open62541.h:3450
void UA_deleteMembers(void *p, const UA_DataType *type)
Definition: open62541.c:5747
#define UA_STATUSCODE_BADTYPEDEFINITIONINVALID
Definition: open62541.h:760
UA_UserTokenPolicy * userIdentityTokens
Definition: open62541.h:5075
#define UA_STATUSCODE_BADNODATA
Definition: open62541.h:836
BrowseRequest ^^^^^^^^^^^^^ Browse the references for one or more nodes from the server address space...
Definition: open62541.h:5000
UA_StatusCode UA_Connection_receiveChunksBlocking(UA_Connection *connection, UA_ByteString *chunks, UA_Boolean *realloced, UA_UInt32 timeout)
Definition: open62541.c:14978
#define UA_STATUSCODE_UNCERTAINNOCOMMUNICATIONLASTUSABLEVALUE
Definition: open62541.h:815
UA_StatusCode UA_Server_write(UA_Server *server, const UA_WriteValue *value)
The following node attributes cannot be changed once a node has been created:
Definition: open62541.c:21169
#define UA_STATUSCODE_BADFILTEROPERANDINVALID
Definition: open62541.h:731
#define UA_TRANSPORT_TCPMESSAGEHEADER
Definition: open62541.c:2633
#define UA_MAXCONTINUATIONPOINTS
Definition: open62541.c:3704
NodeTypeDescription ^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:5098
struct UA_DiagnosticInfo UA_DiagnosticInfo
DiagnosticInfo ^^^^^^^^^^^^^^ A structure that contains detailed error and diagnostic information ass...
#define UA_TYPES_REGISTERNODESRESPONSE
Definition: open62541.h:4309
#define UA_TYPES_DELETENODESREQUEST
Definition: open62541.h:3987
#define UA_FUNC_ATTR_WARN_UNUSED_RESULT
Definition: open62541.h:178
#define MAX_PROFILEARRAY
UA_Double requestedSessionTimeout
Definition: open62541.h:5046
#define UA_TYPES_CALLRESPONSE
Definition: open62541.h:4704
#define UA_STATUSCODE_BADHISTORYOPERATIONUNSUPPORTED
Definition: open62541.h:783
#define UA_STATUSCODE_BADAPPLICATIONSIGNATUREINVALID
Definition: open62541.h:748
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: open62541.c:502
BrowsePathResult ^^^^^^^^^^^^^^^^ The result of a translate opearation.
Definition: open62541.h:4263
#define UA_BUILTIN_TYPES_COUNT
Definition: open62541.h:916
#define UA_STATUSCODE_BADREQUESTTOOLARGE
Definition: open62541.h:660
struct pcg_state_setseq_64 pcg32_random_t
#define UA_TYPES_ENDPOINTDESCRIPTION
Definition: open62541.h:5080
OpenSecureChannelRequest ^^^^^^^^^^^^^^^^^^^^^^^^ Creates a secure channel with a server...
Definition: open62541.h:4288
#define UA_OPEN62541_VER_PATCH
Definition: open62541.h:41
#define UA_TYPES_NODEATTRIBUTESMASK
Definition: open62541.h:3423
#define UA_NS0ID_FOLDERTYPE
Definition: open62541.h:1849
#define UA_STATUSCODE_BADNOTWRITABLE
Definition: open62541.h:714
UA_NODE_BASEATTRIBUTES UA_Boolean isAbstract
Definition: open62541.c:3542
UA_Double minimumSamplingInterval
Definition: open62541.c:3465
UA_BrowseResult * results
Definition: open62541.h:5114
AddReferencesRequest ^^^^^^^^^^^^^^^^^^^^ Adds one or more references to the server address space...
Definition: open62541.h:4787
UA_NodeStore * nodestore
Definition: open62541.c:4220
#define UA_TYPES_QUERYFIRSTRESPONSE
Definition: open62541.h:4982
#define UA_STATUSCODE_BADREQUESTNOTALLOWED
Definition: open62541.h:854
UA_ByteString password
Definition: open62541.h:4026
#define UA_STATUSCODE_BADDECODINGERROR
Definition: open62541.h:658
#define UA_MSEC_TO_DATETIME
Definition: open62541.h:1074
void UA_SecureChannel_attachSession(UA_SecureChannel *channel, UA_Session *session)
Definition: open62541.c:15218
#define UA_STATUSCODE_BADMAXAGEINVALID
Definition: open62541.h:780
#define STARTCHANNELID
Definition: open62541.c:18631
UA_RequestHeader requestHeader
Definition: open62541.h:3330
uint32_t UA_StatusCode
Definition: open62541.h:1011
#define UA_TYPES_CONTENTFILTERELEMENT
Definition: open62541.h:4890
#define TAILQ_HEAD(name, type)
Definition: open62541.c:432
#define UA_STATUSCODE_BADNOENTRYEXISTS
Definition: open62541.h:842
UA_MessageType
MessageType ^^^^^^^^^^^ Message Type and whether the message contains an intermediate chunk...
Definition: open62541.c:2574
#define UA_STATUSCODE_BADCERTIFICATEUSENOTALLOWED
Definition: open62541.h:678
UA_Boolean moreNotifications
Definition: open62541.h:3998
#define UA_STATUSCODE_BADMONITORINGMODEINVALID
Definition: open62541.h:720
UA_UInt32 maxChunkCount
Definition: open62541.h:9454
#define FLOAT_INF
Definition: open62541.c:6174
#define UA_TYPES_SETMONITORINGMODEREQUEST
Definition: open62541.h:4394
UA_UInt32 nodeClassMask
Definition: open62541.h:4442
#define UA_TYPES_NODEID
NodeId ^^^^^^.
Definition: open62541.h:3187
UA_StatusCode UA_ByteString_allocBuffer(UA_ByteString *bs, size_t length)
Definition: open62541.c:4942
size_t endpointDescriptionsSize
Definition: open62541.c:4212
UA_StatusCode * results
Definition: open62541.h:4847
ModifySubscriptionResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4275
UA_Boolean historizing
Definition: open62541.h:3364
size_t dimensionsSize
Definition: open62541.h:1347
UnregisterNodesResponse ^^^^^^^^^^^^^^^^^^^^^^^ Unregisters one or more previously registered nodes...
Definition: open62541.h:4400
struct UA_Job::@5::@7 methodCall
UA_ViewDescription view
Definition: open62541.h:5002
PublishRequest ^^^^^^^^^^^^^^.
Definition: open62541.h:4479
#define UA_NS0ID_SERVER_NAMESPACEARRAY
Definition: open62541.h:2539
#define UA_NS0ID_SERVER_GETMONITOREDITEMS_INPUTARGUMENTS
Definition: open62541.h:2770
UA_Boolean builtin
Definition: open62541.h:1658
UA_Int32 namespaceUri
Definition: open62541.h:1596
UA_AsymmetricAlgorithmSecurityHeader serverAsymAlgSettings
Definition: open62541.c:3237
MonitoredItemModifyRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4012
#define UA_STATUSCODE_BADDOMINANTVALUECHANGED
Definition: open62541.h:859
#define SIMPLEQ_INSERT_TAIL(head, elm, field)
Definition: open62541.c:326
UA_UInt32 timeoutHint
Definition: open62541.h:3306
#define UA_STATUSCODE_BADEVENTIDUNKNOWN
Definition: open62541.h:827
int64_t UA_Int64
Int64 ^^^^^ An integer value between -9 223 372 036 854 775 808 and 9 223 372 036 854 775 807...
Definition: open62541.h:979
#define UA_TYPES_CREATESUBSCRIPTIONRESPONSE
Definition: open62541.h:4637
#define UA_STATUSCODE_BADNODEIDREJECTED
Definition: open62541.h:754
#define UA_TYPES_EXPANDEDNODEID
ExpandedNodeId ^^^^^^^^^^^^^^.
Definition: open62541.h:3193
UA_ResponseHeader responseHeader
Definition: open62541.h:4276
CreateMonitoredItemsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4682
#define UA_TYPES_CONTENTFILTERRESULT
Definition: open62541.h:4608
#define UA_TYPES_DATATYPEATTRIBUTES
Definition: open62541.h:3895
void Service_BrowseNext(UA_Server *server, UA_Session *session, const UA_BrowseNextRequest *request, UA_BrowseNextResponse *response)
Definition: open62541.c:22928
UA_NodeId referenceTypeId
Definition: open62541.h:4616
#define LIST_REMOVE(elm, field)
Definition: open62541.c:258
#define UA_TYPES_BROWSERESULTMASK
Definition: open62541.h:3294
#define UA_STATUSCODE_BADAGGREGATEINVALIDINPUTS
Definition: open62541.h:851
#define UA_TRANSPORT_TCPERRORMESSAGE
Definition: open62541.c:2568
void Service_SetPublishingMode(UA_Server *server, UA_Session *session, const UA_SetPublishingModeRequest *request, UA_SetPublishingModeResponse *response)
#define UA_TYPES_ADDNODESRESULT
Definition: open62541.h:3344
#define UA_PRINTF_STRING_FORMAT
Definition: open62541.h:9731
MonitoredItemNotification ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3840
#define UA_STATUSCODE_BADNODEIDINVALID
Definition: open62541.h:706
BrowsePathTarget ^^^^^^^^^^^^^^^^ The target of the translated path.
Definition: open62541.h:3252
size_t nodesToReadSize
Definition: open62541.h:4803
const UA_VariableTypeNode * getVariableNodeType(UA_Server *server, const UA_VariableNode *node)
Definition: open62541.c:17862
#define UA_NS0ID_SERVERSTATE
Definition: open62541.h:2444
ModifySubscriptionRequest ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4326
#define UA_STATUSCODE_BADCONDITIONBRANCHALREADYCONFIRMED
Definition: open62541.h:832
ModifyMonitoredItemsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4528
void UA_Connection_detachSecureChannel(UA_Connection *connection)
Definition: open62541.c:15005
UA_UInt32 recvBufferSize
Definition: open62541.h:9452
size_t resultsSize
Definition: open62541.h:4698
#define UA_STATUSCODE_BADSHUTDOWN
Definition: open62541.h:665
#define CHECK_ATTRIBUTES(TYPE)
Definition: open62541.c:21921
UA_LocalizedText description
Definition: open62541.h:3958
UA_StatusCode errorCode
Definition: open62541.c:3229
AnonymousIdentityToken ^^^^^^^^^^^^^^^^^^^^^^ A token representing an anonymous user.
Definition: open62541.h:3552
#define UA_TYPES_OPENSECURECHANNELRESPONSE
Definition: open62541.h:4091
UA_StatusCode(* UA_EditNodeCallback)(UA_Server *, UA_Session *, UA_Node *, const void *)
Definition: open62541.c:4257
#define LIST_ENTRY(type)
Definition: open62541.c:205
UA_StatusCode UA_SessionManager_init(UA_SessionManager *sm, UA_Server *server)
Definition: open62541.c:18822
UA_String policyId
Definition: open62541.h:4343
#define UA_STATUSCODE_BADCONDITIONALREADYSHELVED
Definition: open62541.h:833
#define UA_NODE_BASEATTRIBUTES
Definition: open62541.c:3356
#define UA_NS0ID_CALLREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2310
#define UA_TRANSPORT_COUNT
Every type is assigned an index in an array containing the type descriptions.
Definition: open62541.c:2518
LocalizedText ^^^^^^^^^^^^^ Human readable text with an optional locale identifier.
Definition: open62541.h:1313
UA_Boolean hasSourceTimestamp
Definition: open62541.h:1570
#define UA_STATUSCODE_BADTCPMESSAGETYPEINVALID
Definition: open62541.h:797
#define UA_TYPES_BUILDINFO
Definition: open62541.h:3801
#define UA_TYPES_GETENDPOINTSRESPONSE
Definition: open62541.h:5092
CallRequest ^^^^^^^^^^^.
Definition: open62541.h:3590
UA_ChannelSecurityToken nextSecurityToken
Definition: open62541.c:3235
#define UA_STATUSCODE_UNCERTAINLASTUSABLEVALUE
Definition: open62541.h:816
#define LIST_FIRST(head)
Definition: open62541.c:214
void UA_MoniteredItem_SampleCallback(UA_Server *server, UA_MonitoredItem *monitoredItem)
UA_RequestHeader requestHeader
Definition: open62541.h:4289
ContentFilterElement ^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4884
union UA_Job::@5 job
#define UA_TRANSPORT_SEQUENCEHEADER
Definition: open62541.c:2622
#define UA_STATUSCODE_BADCERTIFICATEISSUERUSENOTALLOWED
Definition: open62541.h:679
#define UA_STATUSCODE_BADENDOFSTREAM
Definition: open62541.h:871
UA_StatusCode UA_Server_removeRepeatedJob(UA_Server *server, UA_Guid jobId)
Definition: open62541.c:18248
#define UA_TYPES_QUALIFIEDNAME
QualifiedName ^^^^^^^^^^^^^.
Definition: open62541.h:3205
UA_LocalizedText displayName
Definition: open62541.h:4424
#define UA_TYPES_IDTYPE
Definition: open62541.h:4045
#define UA_NS0ID_BROWSEREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2125